authentication

Refresh OAuth2 provider tokens

Changed on

Refresh the OAuth2 provider access token using a valid refresh token. Returns a new provider session with updated access token, refresh token (if rotated by provider), and expiration information. This endpoint allows maintaining long-lived access to provider APIs without requiring the user to re-authenticate.

post/token/provider/{provider}

Request

  • Base URL
    https://{subdomain}.auth.{region}.nhost.run/v1
  • URL
    https://{subdomain}.auth.{region}.nhost.run/v1/token/provider/{provider}
  • Auth
    HTTP bearer

Path parameters

provider'apple' | 'github' | 'google' | 'linkedin' | 'discord' | 'spotify' | 'twitch' | 'gitlab' | 'bitbucket' | 'workos' | 'azuread' | 'entraid' | 'strava' | 'facebook' | 'windowslive' | 'twitter' required

The name of the social provider

Request body

refreshTokenstring required

OAuth2 provider refresh token obtained from previous authentication

Example request

{
  "refreshToken": "1//0gK8..."
}

Response

Successfully refreshed provider tokens

accessTokenstring required

OAuth2 provider access token for API calls

expiresIninteger required

Number of seconds until the access token expires

expiresAtstring date-time required

Timestamp when the access token expires

refreshTokenstring nullable

OAuth2 provider refresh token for obtaining new access tokens (if provided by the provider)

Example response

{
  "accessToken": "ya29.a0AfH6SMBx...",
  "expiresIn": 3599,
  "expiresAt": "2024-12-31T23:59:59Z",
  "refreshToken": "1//0gK8..."
}

Changes

    • warning

      added the new otp-too-many-attempts enum value to the response property for the response status

    • warning

      added the new user-already-exists enum value to the response property for the response status

    • info

      removed the email-already-in-use enum value from the response property for the response status