Skip to main content
Docs

Verifying OAuth tokens with Clerk

If you are building an application that uses Clerk and would like to incorporate OAuth, you'll want to ensure that, after the client gets an OAuth access token, they can use it to make authenticated requests into your app (the resource service) using the token.

Clerk’s SDKs support this through the acceptsToken parameter that can be used in Clerk's route protection functions, such as auth(), auth.protect() and authenticateRequest().

For detailed examples and best practices on accepting and verifying OAuth tokens with Clerk SDKs, see the following guides:

You can also verify tokens manually via the Clerk REST API. Ensure you have your Clerk Secret Key on hand as you’ll need to include it in the Authorization header - it can be retrieved from the API keys page in the Clerk Dashboard.

terminal
curl https://api.clerk.com/oauth_applications/access_tokens/verify \
  -X POST \
  -H 'Authorization: Bearer your-clerk-secret-key-here' \
  -H 'Content-Type: application/json' \
  -d '{ "access_token": "your-oauth-token-here" }'

Feedback

What did you think of this content?

Last updated on