Token Endpoint & Refresh

The token endpoint is at https://hub.spookysrv.com/index.php?route=/api/v2/oauth2/tokenarrow-up-right

circle-info

We only accept a POST request at the Token Endpoint

Content Type must be application/x-www-form-urlencode

circle-exclamation

Request (Format 1)

Include client_id, client_secret, and code in the POST data field / POST request body

circle-info

For refreshing an access token, pass refresh_token and grant_type=refresh_token in the POST data field / POST request body.

Example CURL Request:

curl -X POST "https://hub.spookysrv.com/index.php?route=/api/v2/oauth2/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "client_id=5ScKa4HaYEFo8uWEKo7O0Vb9nSjxZzigKsTdliBP06M&client_secret=EUx6bSBAm48vgtbHv6hYWTk3UOWSFIyPZDB6aGXSY&code=BREmfapICBknG5daa8h5H60DoUOWDXAlm6HY3fCvE4" 

Example CURL Request: (Refresh Token)

curl -X POST "https://hub.spookysrv.com/index.php?route=/api/v2/oauth2/token"
-H "Content-Type: application/x-www-form-urlencoded"
-d "client_id=5ScKa4HaYEFo8uWEKo7O0Vb9nSjxZzigKsTdliBP06M&client_secret=EUx6bSBAm48vgtbHv6hYWTk3UOWSFIyPZDB6aGXSY&refresh_token=ZEPrdekJ8fo54BuRyIViZNrG8CQtjyLjNW0pfwDXZ4&grant_type=refresh_token"
circle-exclamation

Request (Format 2)

Include code in the POST data field / POST request body Include client_id and client_secret in the Authorization header

Authorization header must be of Basic authentication type, and authentication credentials will be a base64-encoded string of format client_id:client_secret

Example: Authorization: Basic NVNjS2E0SGFZRUZvOHVXRUtvN08wVmI5blNqeFp6aWdLc1RkbGlCUDA2TTpFVXg2YlNCQW00OHZndGJIdjZoWVdUazNVT1dTRkl5UFpEQjZhR1hTWQ==

circle-info

For refreshing an access token, pass refresh_token and grant_type=refresh_token in the POST data field / POST request body.

Example CURL Request:

Example CURL Request: (Refresh Token)

circle-exclamation

Response

A JSON response will be returned in the following format:

circle-info

If requested with a refresh token, both tokens are regenerated. Please save the new refresh token.

Response (OIDC)

A JSON response will be returned in the following format:

circle-info

If requested with a refresh token, both access_token and refresh_token are regenerated. Please save the new refresh token.

id_token is in JSON Web Token (JWT) format

The decoded header of the JWT in JSON should be as follows:

The decoded payload of the JWT in JSON should be as follows:

triangle-exclamation
circle-info

Only the above information will be included in the JWT, if you need info such as avatar url, please send a request to the UserInfo Endpoint with the provided access token.

circle-info

Text behind // are comments and are not included in the response itself

Verifying JWT Authenticity

triangle-exclamation

The signature can be verified using the public key provided at the JWKS URI: https://auth.spookysrv.com/oidc/.well-known/jwks.jsonarrow-up-right

When verifying the JWT, you should check:

  • The iss claim MUST be equal to https://auth.spookysrv.com/oidc/

  • The aud claim MUST be equal to YOUR CLIENT ID

  • The exp claim date has NOT PASSED (NOT EXPIRED)

  • The JWT signature is valid with the JWKs listed above

circle-info

Spooky Services ONLY signs with ONE ES256 key for signature

Last updated