Skip to content

OAuth Clients

OAuth clients represent applications that authenticate users or access APIs through Paylent. Each client has a unique client_id and is configured with the grant types, redirect URIs, and token format it needs.

TypeSecretUse Case
ConfidentialYes — stored securely server-sideBackend applications, server-to-server
PublicNo — cannot store secrets safelySPAs, mobile apps, CLIs

Go to Applications in the OAuth section of the sidebar and click Register Application.

For confidential clients, the client secret is shown once after registration. Copy it immediately — it cannot be retrieved in plaintext again.

Terminal window
curl -X POST https://acme-test.paylent.com/api/clients \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer ACCESS_TOKEN" \
-d '{
"data": {
"type": "client",
"attributes": {
"name": "My Web App",
"client_type": "confidential",
"redirect_uris": ["https://myapp.example.com/callback"],
"grant_types": ["authorization_code", "refresh_token"],
"token_format": "jwt"
}
}
}'

The response metadata includes client_secret for confidential clients. Store it securely.

Each client can be configured with one or more grant types:

Grant TypeDescription
authorization_codeUser login via browser redirect (default)
client_credentialsMachine-to-machine, no user involved
refresh_tokenExchange a refresh token for a new access token
FormatDescription
jwtRS256-signed JSON Web Token. Verify locally using the JWKS endpoint.
opaqueRandom string. Validate via the introspection endpoint.

Redirect URIs define where Paylent sends users after authorization. During the authorization code flow, the redirect_uri parameter must exactly match one of the registered URIs.

  • Must be valid HTTP or HTTPS URLs
  • Maximum 10 URIs per client

Setting a client as first-party skips the consent screen during the authorization code flow. Use this for your own applications where user consent is implicit. This setting cannot be changed after registration.

The client_id is a 32-character hex string, generated automatically. For confidential clients, the client_secret is a URL-safe base64 string.

Confidential clients authenticate using HTTP Basic auth with client_id:client_secret:

Terminal window
curl -X POST https://acme-test.paylent.com/oauth/token \
-u "CLIENT_ID:CLIENT_SECRET" \
-d "grant_type=client_credentials&scope=read:users&resource=https://api.yourcompany.com"

For the client credentials grant, clients must be explicitly linked to the API Resources they can access. This is done through Client Resource Server Grants.

A grant links a client to an API Resource and optionally limits which scopes the client can request:

  • Empty allowed_scopes — the client can request any scope on the API
  • Specific scopes listed — the client can only request those scopes

Grants are managed in the dashboard when viewing an API Resource, or via the Management API.

Without a grant, client credentials requests for that API will be rejected with "Client is not authorized for resource server".

Terminal window
curl -X PATCH https://acme-test.paylent.com/api/clients/CLIENT_ID \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer ACCESS_TOKEN" \
-d '{
"data": {
"type": "client",
"id": "CLIENT_ID",
"attributes": {
"name": "Updated App Name",
"redirect_uris": ["https://myapp.example.com/callback", "https://myapp.example.com/auth"],
"grant_types": ["authorization_code", "client_credentials", "refresh_token"],
"token_format": "opaque"
}
}
}'

Deleting a client revokes all associated tokens. This action cannot be undone.

Terminal window
curl -X DELETE https://acme-test.paylent.com/api/clients/CLIENT_ID \
-H "Authorization: Bearer ACCESS_TOKEN"