Skip to content

Authentication

Request

POST https://auth-dev.spay.ng/api/v1/oauth/token
Content-Type: application/x-www-form-urlencoded
Accept: application/json
client_id=<client-id>&client_secret=<client-secret>&grant_type=client_credentials
curl
curl -X POST 'https://auth-dev.spay.ng/api/v1/oauth/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json" \
--data-urlencode "client_id=$SPAY_CLIENT_ID" \
--data-urlencode "client_secret=$SPAY_CLIENT_SECRET" \
--data-urlencode "grant_type=client_credentials"

Request fields

FieldTypeRequiredDescription
grant_typestring, client_credentialsYesThe OAuth grant. Only client credentials is supported.
client_idstringYes, unless sent with HTTP BasicYour client’s id.
client_secretstringYes, unless sent with HTTP BasicYour client’s secret.
scopestringNoDon’t send it. The token carries the scopes your client was set up with.

Response: 200 OK

Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
{
"access_token": "<access-token>",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "<granted-scopes>"
}

Response fields

FieldTypeDescription
access_tokenstringThe Bearer token to send on every API call.
token_typestring, BearerHow to present the token.
expires_ininteger, secondsHow long the token lasts (3600).
scopestring, space-separatedThe scopes the token carries. Needs no handling.

Errors

HTTP statusBody
400{"error":"invalid_request","error_description":"Malformed token request"}
400{"error":"unsupported_grant_type","error_description":"Grant type is not supported"}
400{"error":"unauthorized_client","error_description":"Client is not permitted to use this grant type"}
401{"error":"invalid_client","error_description":"Client authentication failed"}
429{"error":"temporarily_unavailable","error_description":"Rate limit exceeded"}, with Retry-After in seconds
500{"error":"server_error","error_description":"Token request could not be processed"}
  • There is no refresh token: request a new one before expiry or on a 401.
  • The token endpoint allows 60 requests a minute per source IP.
  • HTTP Basic client authentication is also accepted. Use one method per request.
  • A call to an endpoint your client isn’t set up for returns 403, code 63.
  • Issuer https://auth-dev.spay.ng, discovery https://auth-dev.spay.ng/.well-known/openid-configuration, JWKS https://auth-dev.spay.ng/api/v1/oauth/jwks.