Skip to content

OAuth Endpoints

Paylent implements the OAuth 2.0 and OpenID Connect specifications. These endpoints handle authorization, token exchange, introspection, and discovery.

GET /.well-known/openid-configuration

Returns the OIDC discovery document with all supported endpoints, grant types, and signing algorithms.

GET /.well-known/jwks.json

Returns the public signing keys for JWT verification. Use this to validate access tokens locally without calling the introspection endpoint.

GET /oauth/authorize

Initiates the authorization code flow. The user must have an active session.

ParameterRequiredDescription
response_typeYesMust be code
client_idYesThe OAuth client’s ID
redirect_uriYesMust match a registered redirect URI
scopeNoSpace-separated list of scopes
stateRecommendedOpaque value for CSRF protection
code_challengeRecommendedPKCE code challenge
code_challenge_methodRecommendedMust be S256

On success, redirects to the redirect_uri with code and state query parameters.

POST /oauth/token

Exchanges credentials for access tokens. Requires client authentication via HTTP Basic Auth (client_id:client_secret).

ParameterRequiredDescription
grant_typeYesauthorization_code
codeYesThe authorization code
redirect_uriYesMust match the original request
code_verifierIf PKCEThe PKCE code verifier
ParameterRequiredDescription
grant_typeYesclient_credentials
scopeNoRequested scopes
ParameterRequiredDescription
grant_typeYesrefresh_token
refresh_tokenYesThe refresh token
{
"access_token": "eyJhbGciOiJSUzI1NiIs...",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "dGhpcyBpcyBhIHJlZnJlc2g..."
}
POST /oauth/introspect

Validates a token and returns its metadata. Requires client authentication.

ParameterRequiredDescription
tokenYesThe token to introspect
{
"active": true,
"scope": "openid profile",
"client_id": "CLIENT_ID",
"token_type": "Bearer",
"exp": 1707400000,
"sub": "USER_ID"
}
{
"active": false
}
POST /oauth/revoke

Revokes an access or refresh token. Requires client authentication.

ParameterRequiredDescription
tokenYesThe token to revoke

Returns 200 OK on success (even if the token was already revoked or invalid, per RFC 7009).

GET /oauth/userinfo
POST /oauth/userinfo

Returns claims about the authenticated user. Requires a valid Bearer token in the Authorization header.

Terminal window
curl https://acme-test.paylent.com/oauth/userinfo \
-H "Authorization: Bearer ACCESS_TOKEN"