magicberbere
bolg55
ts import { db } from '@db/index'; import { users, profiles } from '@db/schema'; const thirdPartySignInUpOverride = (originalImplementation) => async (input) => { let response = await originalImplementation.thirdPartySignInUp(input); if (response.status === 'OK') { let { id, emails } = response.user; console.log('USER SIGNED UP', id); await db.transaction(async (trx) => { await trx.insert(users).values({ id, email: emails[0], }); await trx.insert(profiles).values({ userId: id, }); }); // This is the response from the OAuth 2 provider that contains their tokens or user info. let providerAccessToken = response.oAuthTokens['access_token']; let firstName = response.rawUserInfoFromProvider.fromUserInfoAPI!['first_name']; if ( response.createdNewRecipeUser && response.user.loginMethods.length === 1 ) { // TODO: Post sign up logic } else { // TODO: Post sign in logic } } return response; }; export default thirdPartySignInUpOverride;
originalImplementation
florian_lefebvre
updateUserMetadata
ts const attemptRefreshingSession = await Session.attemptRefreshingSession(); const sessionExists = await Session.doesSessionExist(); if (sessionExists) { const user_id = await Session.getUserId(); const accessTokenPayload = await Session.getAccessTokenPayloadSecurely();
accessTokenPayload
json "supertokens-node": "^13.1.5", "supertokens-web-js": "^0.5.0",
shashank0959
SuperEric
matth_na
andrewbyrley
WonderPandaDev
http://localhost:3000/api/auth/signup/email/exists?email={email}
Manoj G
simon7000
supertokens-node supertokens-auth-react supertokens-web-js
SuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).