Skip to navigation

Request an access token

Issues an access token for your application with the OAuth 2.0 client_credentials grant.

Request

Send grant_type=client_credentials as application/x-www-form-urlencoded (RFC 6749) or as JSON with the same parameter names. Send each parameter once, in the body, never in the URL query. scope is space-separated and must name only scopes your application is allowed; omit it to receive all of them. See requesting tokens.

Client authentication

Authenticate the client with exactly one of client_secret_basic, client_secret_post or private_key_jwt. With private_key_jwt:

  • send client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer;
  • sign the assertion with an RS256 or ES256 key registered for the application in the Partner Hub;
  • set iss = sub = client_id, and aud = this endpoint’s URL;
  • set exp at most five minutes ahead;
  • use a single-use jti.

Response

{access_token, token_type: "Bearer", expires_in, scope}, with an evpa_live_… or evpa_test_… token. expires_in is the token’s lifetime in seconds, 900 by default, and scope lists the scopes it carries. There is no refresh token: request a new token when the current one expires. The token answer, like every OAuthTokenError answer, carries Cache-Control: no-store and Pragma: no-cache.

Errors

Errors use the RFC 6749, section 5.2 body (OAuthTokenError), except INVALID_REQUEST, which uses the common Error envelope:

  • 400 INVALID_REQUEST — the body does not ask for grant_type=client_credentials, for example because grant_type is missing.
  • 400 invalid_request — a malformed request: a parameter sent twice, too long or in the URL query, more than one client authentication method, client_secret without client_id, or client_assertion without client_assertion_type.
  • 400 unsupported_grant_type — this environment does not offer the client_credentials grant.
  • 400 unauthorized_client — the application is not active, or its agency is suspended.
  • 400 invalid_scope — a malformed scope, more than 64 scopes, or a scope beyond the application’s allowed scopes.
  • 401 invalid_client — any client authentication failure. The answer is the same constant in every case, with WWW-Authenticate: Basic when you used HTTP Basic.
  • 503 temporarily_unavailable — EVVA cannot answer right now, and no token is issued. Retry after Retry-After.

Authentication

AuthorizationBasic

Client authentication at the token and revocation endpoints with the client id and secret (client_secret_basic, RFC 6749, section 2.3.1). client_secret_post and private_key_jwt send the credentials in the form body instead.

Request

This endpoint expects an object.
grant_type"client_credentials"Required
scopestringOptional

Space-separated; a subset of the application’s allowed scopes.

client_idstringOptional
client_secretstringOptional
client_assertion_type"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"Optional
client_assertionstringOptional

A JWT signed with RS256 or ES256. Set iss and sub to your client_id, aud to the token URL, and exp at most 5 minutes ahead; jti must be single-use.

Response headers

Pragma"no-cache"Optional

Response

The access token. The answer carries Cache-Control: no-store and Pragma: no-cache.

access_tokenstringformat: "^evpa_(live|test)_"
token_type"Bearer"
expires_ininteger60-3600

The token’s lifetime in seconds. 900 by default; a deployment may set it between 60 and 3600, so read it rather than assume it.

scopestring

Errors

400
Bad Request Error
401
Unauthorized Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error