Skip to content

Latest commit

 

History

History
123 lines (89 loc) · 3.83 KB

File metadata and controls

123 lines (89 loc) · 3.83 KB

Token and API Key API


Refresh Token

POST /auth/v1/token/refresh

Validate and refresh PASTA and EDI authentication tokens. A refreshed token matches the original but has a new TTL. The EDI token is considered authoritative — the PASTA token is refreshed even if it has expired, as long as the EDI token is still valid.

Note: This method is optimized for high traffic. It works directly with the tokens and does not query the database, LDAP, or the OAuth2 IdPs.

Required permission: Both a valid pasta-token and edi-token are required.

Parameters

Parameter In Required Description
pasta-token JSON body Yes Current PASTA authentication token
edi-token JSON body Yes Current EDI authentication token

Response

Status Description
200 OK Tokens refreshed successfully
400 Bad Request See Parameters
401 Unauthorized One or both tokens are invalid or expired
403 Forbidden See Parameters

200 OK response body:

Field Description
method "getTokenByKey"
msg "PASTA and EDI tokens refreshed successfully"
pasta-token Refreshed PASTA token
edi-token Refreshed EDI token

Example

Request:

curl -X POST https://auth.edirepository.org/auth/v1/token/refresh \
  -d '{
    "pasta-token": "uid=EDI,o=EDI,dc=edirepository...",
    "edi-token": "eyJhbGciOiJFUzI1NiIsInR5cCI6I..."
  }'

Response 200 OK:

{
  "method": "getTokenByKey",
  "msg": "PASTA and EDI tokens refreshed successfully",
  "pasta-token": "uid=EDI,o=EDI,dc=edirepository...",
  "edi-token": "eyJhbGciOiJFUzI1NiIsInR5cCI6I..."
}

Get Token by API Key

POST /auth/v1/key

Retrieve an authentication token using an API key.

Required permission: None.

Parameters

Parameter In Required Description
key JSON body Yes API key

Response

Status Description
200 OK Token created successfully
400 Bad Request See Parameters
401 Unauthorized API key is invalid or expired
403 Forbidden See Parameters

200 OK response body:

Field Description
method "getTokenByKey"
msg "Token created successfully"
edi-token The new authentication token

Example

Request:

curl -X POST https://auth.edirepository.org/auth/v1/key \
  -d '{"key": "R9arQwYMFqdgVVYt7jqcsxfyPyU"}'

Response 200 OK:

{
  "method": "getTokenByKey",
  "msg": "Token created successfully",
  "edi-token": "eyJhbGciOiJFUzI1NiIsInR5cCI6I..."
}