Skip to main content
API Reference / modelence / client / loginWithOAuth
loginWithOAuth(options): Promise<null | User>
Defined in: packages/modelence/src/auth/client/index.ts:376 Complete a native OAuth sign-in with the code from the deep link. Exchanges the single-use code that signInWithOAuth delivered to your app’s deep link for a session, stores the auth token, and returns the signed-in user. Codes are valid for one minute and can only be redeemed once. Pairs with signInWithOAuth({ provider, redirectUri }) — the flow that hands a code back to your app. It works on native and under Expo Web, where the verifier is kept in sessionStorage so it survives the navigation to the provider. A plain web app that calls signInWithOAuth({ provider }) with no redirectUri is signed in by a session cookie and never needs this. The verifier minted by signInWithOAuth is replayed here, which is what makes a code usable only by the client that started the flow. Calling this without a preceding signInWithOAuth — as a crafted deep link would — fails before the code is ever sent.

Example

Parameters

Returns

Promise<null | User>