access_token or id_token.
Stytch will use the JWKS endpoint hosted by your existing infrastructure to validate these JWTs.
This guide uses Supabase as an example, but the same pattern works for any provider with a public JWKS.
Logging a user in
Configure a Trusted Auth Token Profile
In the Stytch Dashboard, create a Trusted Auth Token Profile for your external provider. In order to validate JWTs from Supabase, set the following values:
Add an attribute mapping for the claims you want to import. To map Supabase user information to Stytch, set the following:
| Name | Value |
|---|---|
| Issuer | https://$project-id.supabase.co/auth/v1/ |
| Audience | authenticated |
| JWKS | https://$project-id.supabase.co/auth/v1/.well-known/jwks.json |
| Name | Value |
|---|---|
email | |
| token_id | session_id |
Send the external token to your backend
After you mint or retrieve the provider JWT, send it to your backend so it can be exchanged for a Stytch session. For Supabase, use the Supabase SDK to retrieve an access token JWT:
Exchange the token for a Stytch session
Use the Attest Session endpoint to exchange the token for a Stytch session.