Procedure:
Concatenate the API key with the current timestamp in the format below: <<APIKEY>>_<<timestamp(yyyy'-'MM'-'ddTHH:mm:ss.fffZ)>>
Create a SHA256 hash of this value. Based on the hashed value, a digital signature will be created.
The combination of the created signature along with the provided API secret key will act as the digital signature of the call.
Send these values to the login action.
After successful validation, a JWT Access bearer token will be provided.
The validity of the JWT token is 1 hour. The parameter refreshToken
allows you to extend the session by renewing the JWT token from the server-side before the existing token expires.
To make this process easier, a sample application is created which can be used to validate if the created signature is correct. It is also available on https://github.com/gantner-nv/EnvisoApiAuthentication
Example:
Assuming we have the following data
The hashed value of step 2 will be:
9952375a30708b46739986482303cae30ad51fc9a362b5794d298dfc22f7ec02
The signature of step 3 will be:
iMTchrTU9pMWFDRYQNCnUiD2ekDdCgp0ybN7xzvj9DLtceTFsF/kxzr9q5OnqP0quyt7OGBZ/vEQlOKhODxK2wsAml/v9Rm9Ha/CVTbQ2jVWxUH3HyDqDSRQBfYPlA79vxP2CcFEB1DbNla9TlBAwovSJVy9D0oURPoe8XrJqog=
The values to post to the login action will be:
{ "apikey": "QrCDN6CcXkGOnRiNcZMrpw==", "timestamp": "2018-01-22T13:58:33.871Z", "signature": "iMTchrTU9pMWFDRYQNCnUiD2ekDdCgp0ybN7xzvj9DLtceTFsF/kxzr9q5OnqP0quyt7OGBZ/vEQlOKhODxK2wsAml/v9Rm9Ha/CVTbQ2jVWxUH3HyDqDSRQBfYPlA79vxP2CcFEB1DbNla9TlBAwovSJVy9D0oURPoe8XrJqog=" }
Send values to the Login action.
Login
POST /{version}/login
x-api-key: QrCDN6CcXkGOnRiNcZMrpw==
Host:
For Direct selling API: https://api.staging-enviso.io/directsellingapi
For Reselling API: https://api.staging-enviso.io/resellingapi
For eLoxx API:https://api.staging-enviso.io/eloxxapi
For Scanning API:https://api.staging-enviso.io/scanningapi
Content-Type: application/json
Cache-Control: no-cache
{ "apikey": "QrCDN6CcXkGOnRiNcZMrpw==", "timestamp": "2018-01-22T13:58:33.871Z", "signature": "iMTchrTU9pMWFDRYQNCnUiD2ekDdCgp0ybN7xzvj9DLtceTFsF/kxzr9q5OnqP0quyt7OGBZ/vEQlOKhODxK2wsAml/v9Rm9Ha/CVTbQ2jVWxUH3HyDqDSRQBfYPlA79vxP2CcFEB1DbNla9TlBAwovSJVy9D0oURPoe8XrJqog=" }