provider Oauth POST
/v1/oauth/attach @utdk/stytch
/v1/oauth/attach Attach
Generate an OAuth Attach Token to pre-associate an OAuth flow with an existing Stytch User. Pass the returned `oauth_attach_token` to the same provider's OAuth Start endpoint to treat this OAuth flow as a login for that user instead of a signup for a new user.
Exactly one of `user_id`, `session_token`, or `session_jwt` must be provided to identify the target Stytch User.
**Note**: This is an optional step in the OAuth flow. Stytch can often determine whether to associate a new OAuth login with an existing User based on verified information (such as an email address) from the identity provider. This endpoint is useful for cases where we can't, such as missing or unverified provider information.
See our [OAuth email address behavior](https://stytch.com/docs/guides/oauth/email-behavior) resource for additional information.
Try it
Authentication
Configure credentials for Stytch API
Gateway
The gateway proxies requests and injects credentials server-side. Configure credentials above, then enter your gateway URL.
Saved automatically to browser storage.
Code snippet
Updates live as you fill in the form above.
TypeScript
import stytch from '@utdk/stytch';
await stytch.apiOauthV1Attach()