Connected Apps
Exchange Refresh Token
Exchange a refresh token for an access token for a Connected App client.
POST
This endpoint uses your Custom Domain. TheDocumentation Index
Fetch the complete documentation index at: https://stytch.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
refresh_token grant type is used to periodically exchange a refresh token for a new access token without user interaction. When using the refresh_token grant type, a refresh_token must be provided.
This endpoint returns different responses depending on the client being used:
- If a First Party Public or Third Party Public client is used, the original refresh token sent in the request will be rotated out and a new
refresh_tokenwill be present in the response. You must save this new token for next time. Each refresh token has an expiry of 3 months from issuance. - If a First Party Confidential or Third Party Confidential client is used, no token rotation will occur. The refresh token used in the request will remain valid for future use and no new
refresh_tokenwill be present in the response. The refresh token has an initial expiry of 3 months, and each use extends its lifetime by another 3 months.
access_token_expiry_minutes field, which defaults to one hour.
You can validate and examine your access and refresh tokens by using the Token Introspection Endpoint.
Access token JWTs can be validated locally by using a Stytch Backend SDK, or any library that supports the JWT protocol.
Unlike other Stytch API endpoints, this endpoint is not authenticated with a
project_id and project_secret pair. Instead, it is authenticated via the client_id and client_secret of an active Connected App Client within the current project.- This endpoint supports passing the
client_idandclient_secretwithin the request body as well as within a HTTP-Basic Auth header. - This endpoint supports both
application/jsonandapplication/x-www-form-urlencodedcontent types.
We recommend using the Custom Domain whenever possible. For backwards compatibility reasons, this endpoint is also available at
https://test.stytch.com/v1/public/${projectId}/oauth2/token.Body
The ID of the Connected App client.
The secret of the Connected App client. Required for confidential clients
The OAuth2 defined grant type that should be used to acquire an access token. Either
authorization_code or refresh_token is supported for Connected App clients. An error will be returned if this parameter is omitted.A refresh token previously issued to the client. This field is required when using the
refresh_token grant.Response
The access token granted to the client. Access tokens are JWTs signed with the project’s JWKS.
An opaque token that may be used in the future to retrieve a new access token. Only returned if the
offline_access scope is granted.The type of the returned access token. Today, this value will always be equal to “bearer”
The lifetime in seconds of the access token. For example, the value 3600 denotes that the access token will expire in one hour from the time the response was generated.