---
title: "Refresh OAuth2 provider tokens"
method: POST
path: "/token/provider/{provider}"
tags: ["authentication"]
---

# Refresh OAuth2 provider tokens

`POST /token/provider/{provider}`

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.

## Path parameters

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

## Request body

- RefreshProviderTokenRequest — Request to refresh OAuth2 provider tokens
  - `refreshToken` string, required — OAuth2 provider refresh token obtained from previous authentication

## Response `200`

Successfully refreshed provider tokens

- ProviderSession — OAuth2 provider session containing access and refresh tokens
  - `accessToken` string, required — OAuth2 provider access token for API calls
  - `expiresIn` integer, required — Number of seconds until the access token expires
  - `expiresAt` string, date-time, required — Timestamp when the access token expires
  - `refreshToken` string, nullable — OAuth2 provider refresh token for obtaining new access tokens (if provided by the provider)

## Other responses

- `default` — An error occurred while processing the request

---

[API](https://skmtc.net/nhost/apis/nhost-authentication-api.md) · [All operations](https://skmtc.net/nhost/apis/nhost-authentication-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/nhost/nhost-authentication-api/versions/a5c0d88b55c4/schema)
