Skip to main content

Authorization in the Connected Courier Service

Integrating the Gold Apple IS with external systems — in this case, the courier service's IS — requires compliance with predefined security parameters. Authorization is performed using a login and password issued by the courier service's technical specialists. The service uses the username and password to generate an access token, which it returns in the response body. Use this token to authenticate subsequent requests. The token's lifetime is set by the courier service IS and is not regulated by the Gold Apple IS. When implementing the authorization mechanism in the courier service IS, it is necessary to independently determine the minimum token lifetime required to process integration requests reliably. The received token must be passed with every request to protected endpoints in accordance with the Bearer Token authentication scheme, in the HTTP Authorization header, in the following format:

info

Authorization: Bearer <access_token>

URL Requirements​

The endpoint must be published over the secure HTTPS protocol. The endpoint URL must conform to the following path structure: /api/v1/auth/login.

Any domain name belonging to the courier service's IS may be used. The full URL is formed by the courier service's IS and must have the following format: https://<domain>/api/v1/auth/login

Token Requirements​

Cryptographic function — SHA256. Password parameters:

  • uppercase and lowercase letters
  • digits
  • special characters
  • > 12 characters

A JWT token is generated based on the login/password pair. This is the so-called access token. Parameters:

  • lifetime — set by the courier service IS (minimum acceptable period);
  • signing:
    • secret key – a cryptographically strong key (a set of characters, 32+ in length);
    • algorithm — SHA256;
  • issuer — <courier service name>
  • audience (consumer) — goldapple
  • validation:
    • lifetime
    • signature
    • the Issuer and Audience fields

Basic Information​

Request method typePOST
Path / URL/api/v1/auth/login
DescriptionMethod for authenticating the Gold Apple Unified API in the courier service's IS
DirectionThe request is executed by the Gold Apple IS. The response is provided by the courier service.

Request​

Required Headers​

ParameterData typeRequiredDescriptionComment
Hoststring1Gold Apple Unified API hostFilled in as "subdomain.domain.zone"
Content-Typestring1Request content typeFilled in as "application/json"

Payload​

ParameterData typeRequiredDescription
usernamestring1Username (login) issued by the courier service
passwordstring1Password for authentication, issued by the courier service

Request example​

{
"username": "Goldapple_UAPI",
"password": "*************"
}

Response​

Response Codes and Messages​

CodeStatusMessageReason
200OKSuccess responseEverything completed successfully
400Bad RequestMissing or inappropriate required parametersRequired parameters are missing or invalid. The response body must list the names of the fields that failed validation, in an arbitrary string format.
500Internal Server ErrorServer unavailableThe server is unavailable

Successful Response Parameters​

ParameterData typeRequiredDescription
access_tokenstring1Access token issued per login/password pair.
expires_instring1Token lifetime, specified in seconds.

Successful response example​

{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.
SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"expires_in": "2592000"
}

Unsuccessful Response Parameters​

ParameterData typeRequiredDescription
errorstring1Human-readable description of the error

Unsuccessful response example​

{
"error": "Missing or inappropriate required parameters"
}