flixoflax
djodjo02130
aimproxy
Λ C Ξ L X R D
execreate
TheRien
dinko7
edubacco
listmalarinn
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
SuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).