Authentication & Authorization

For authentication & authorization, PoS API use JSON Web Tokens (JWTs).

Authenticate requests

The API will reject any request that does not include a valid JWT in the HTTP Authorization Header. Thus, the first step is to retrieve a valid JWT from our authorization service.

Retrieve a valid access token

Following request will call our authorization service over HTTPS with private credentials in order to retrieve a temporary access_token(JWT).

Auth request
Copy
Auth response
Copy

Make authenticated requests to PoS API

Each request to the PoS API will require a valid access_token (JWT) in the HTTP Authorization header using the Bearer authentication scheme. Use the access_token previously retrieved in every requests to the PoS API.

PoS API - Request example
Copy

PoS API will respond with HTTP 401 Unauthorized if the access token used is not valid or has expired.

Renew the access

As the access token is valid during a limited amount of time, it is necessary to renew the token once expired. The renewal can be done using the same initial request to the authorization service (see Retrieve a valid access token) or via a refresh_token.

Use refresh token to implement sliding sessions

Sliding sessions are sessions that can be extended in order to only expire after a period of inactivity. For this purpose, a refresh token is handy: the access can be renewed without prompting the user to add his username and password again.

Auth response - Extract
Copy
Auth request with refresh token
Copy

Use expires_in to optimise the access renewals

In theory, the client can retrieve a new access_token before each request, but this is obviously not optimal from a performance point of view. Instead, the client could store the number value contained in expires_in in the some local storage or cache after a first valid access token was retrieved. Then, this value can be used to only renew the access when needed.

Auth response - Extract
Copy

Communication over TSL/SSL

The Chimpy POS API allows communication only via HTTPS (Hypertext Transfer Protocol Secure). All data is secured via Transport Layer Security protocol (TLS) that ensures encryption, data integrity and authentication of requests.

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard