Lucifer979
ITEnthusiasm
ThirdPartyEmailPassword
*withoutRequestResponse()
tahiatgonicpp_57357
daylululu
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
idanto
michael_pxr
sammon2412
javascript import express from "express"; import { verifySession } from "supertokens-node/recipe/session/framework/express"; import { SessionRequest } from "supertokens-node/framework/express"; let app = express(); app.post("/like-comment", verifySession(), (req: SessionRequest, res) => { let userId = req.session!.getUserId(); //.... });
verifySession()
/like-comment
SessionAuth
krrishan
SuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).