Authentication

Exchange ID token for access token

Changed on

Exchange an ID token for an access token using OAuth 2.0 token exchange. This endpoint is used internally by the SDK when token exchange is configured.

post/oauth/token

Request

  • Base URL
    https://auth.sunnyhealthai.com
  • Auth
    none declared

Request body application/x-www-form-urlencoded

grant_typestring required
subject_tokenstring required

The ID token to exchange

subject_token_typestring required

Token type identifier (e.g., "urn:sunny-health-external-mock:id-token")

audiencestring required

API audience for the access token

client_idstring required

Auth0 client ID

Example request

{
  "grant_type": "urn:ietf:params:oauth:grant-type:token-exchange",
  "audience": "https://api.sunnyhealthai-staging.com"
}

Response

Token exchange successful

access_tokenstring required

Access token for API authentication

token_typestring required
expires_ininteger required

Token expiration time in seconds

Example response

{
  "token_type": "Bearer",
  "expires_in": 3600
}

Changes