Skip to main content

Token Endpoint

Exchange authorization code for access tokens.
token
POST
required
POST https://api.prefid.dev/oauth/token

Authorization Code Grant

curl -X POST "https://api.prefid.dev/oauth/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=authorization_code" \
  -d "client_id=YOUR_CLIENT_ID" \
  -d "client_secret=YOUR_CLIENT_SECRET" \
  -d "code=AUTH_CODE" \
  -d "redirect_uri=https://yourapp.com/callback" \
  -d "code_verifier=PKCE_VERIFIER"

Parameters

ParameterTypeRequiredDescription
grant_typestringYesMust be authorization_code
client_idstringYesYour OAuth client ID
client_secretstringYesYour OAuth client secret
codestringYesAuthorization code from redirect
redirect_uristringYesMust match registered URI
code_verifierstringYesPKCE code verifier

Refresh Token Grant

curl -X POST "https://api.prefid.dev/oauth/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=refresh_token" \
  -d "client_id=YOUR_CLIENT_ID" \
  -d "client_secret=YOUR_CLIENT_SECRET" \
  -d "refresh_token=prefid_rt_xxxxx"

Token Introspection

Check if a token is valid.
curl -X POST "https://api.prefid.dev/oauth/introspect" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -H "Authorization: Basic BASE64(client_id:client_secret)" \
  -d "token=prefid_at_xxxxx"

Token Revocation

Revoke an access or refresh token.
curl -X POST "https://api.prefid.dev/oauth/revoke" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -H "Authorization: Basic BASE64(client_id:client_secret)" \
  -d "token=prefid_rt_xxxxx" \
  -d "token_type_hint=refresh_token"

User Info

Get information about the authenticated user.
curl -X GET "https://api.prefid.dev/oauth/userinfo" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"