Get token
In order to login, we need to perform /token request using clientId and clientSecret we received via Wholesaler Portal.
After following these steps, you should take this access token and pass it in all the next mentioned REST API endpoints as an “Authorization” header with “Bearer” prefix.
Request
Request:HTTP Method | POST | |
URL | Stage | https://api.stage.ananastest.com/iam/api/v1/auth/token |
Production | https://api.ananas.rs/iam/api/v1/auth/token |
Request Body:
Fields name | Type | Description |
grantType | String | Always “CLIENT_CREDENTIALS” |
clientId | String | Received via Wholesaler Portal |
clientSecret | String | Received via Wholesaler Portal |
scope | String | Always “wholesale_public_api/wholesale_public_api_full_access” |
Example of request:
{
"grantType": "CLIENT_CREDENTIALS",
"clientId": "1e1hpa0akecovl2c8nus08ha9",
"clientSecret": "XWvxKGAtO31aa5jQ+OHPkhgoDAfoynCbB5TlEAu/Us1JBuXpOV1DAlbY6zsYvfby28Gbk78lQyjFgz26wl0ZdOl5k/ M=",
"scope": "wholesale_public_api/wholesale_public_api_full_access"
}
Response Body:
Fields name | Type | Description |
id_token | Long | Not available |
access_token | String | Token which will be used to access other API endpoints |
refresh_token | String | Not available |
expires_in | String | Time in seconds when token will expire |
token_type | String | Always Bearer |
Example of response:
{
"id_token": null,
"access_token": "eyJraWQiOiJvY1ZZbHpcL3E1RDlNZnh4TGtHODZFYzVFQmp5WkN3MjMxaUt1a0h2Y1ZMbz0iLCJhbGciOiJSUz\n I1NiJ9.eyJzdWIiOiIxZTFocGEwYWtlY292bDJjOG51czA4aGE5IiwidG9rZW5fdXNlIjoiYWNjZXNzIiwic2NvcGUiOiJw\n dWJsaWNfYXBpXC9mdWxsX2FjY2VzcyIsImF1dGhfdGltZSI6MTY0MTg5MDI5NywiaXNzIjoiaHR0cHM6XC9cL2N\n vZ25pdG8taWRwLmV1LWNlbnRyYWwtMS5hbWF6b25hd3MuY29tXC9ldS1jZW50cmFsLTFfSm8xVmdORHZLIiwi\n ZXhwIjoxNjQxODkxMTk3LCJpYXQiOjE2NDE4OTAyOTcsInZlcnNpb24iOjIsImp0aSI6IjU1M2FmZDkxLWVkMzktN\n DA5OS1hOWFiLTRiODcyM2I0MzA2OSIsImNsaWVudF9pZCI6IjFlMWhwYTBha2Vjb3ZsMmM4bnVzMDhoYTkifQ.\n iWlniCebgKNF4XkpUF0bU_KGVxqNwAIBwOwwv7Jp_wG5v_kjYfx7tlqNOtfsorEz7_Iav0dxZqRHHYs1FhKg0W3Njj\n w3M77MBdR-tByt-N-yAyR60sc-9t9yxiHZABeDXvfeEnsmT7rBHRaF9KtccXAhaJZq5r9GRBLsYOOQ87NIslILeUd_C-foH8f2JDtj2ofyF_3w4P29q0RshXaHBk0nqLGQlyX3yaj-fySwWxC0qgcP1yfYvuu5rOi312f9IFeQFacsDB9Fs586EzlDv27g8NK4LJtDxHbOoBOVH9P6P1WTL5eSekNLx1WHwHC2xWaHbT\n aH5mwhKXOjFsQ",
"refresh_token": null,
"expires_in": 900,
"token_type": "Bearer"
}