I have been able to generate my ACCESS TOKEN by using my account CLIENT ID and CLIENT SECRET KEY. My challenge is that even though I am passing the ACCESS TOKEN in the request header of the API for getting price, I got error in the API response. The error message is: ```
{
“error”: “INVALID_GRANT”,
“message”: “The access token was revoked”
}
My question now is where should I use the access token to make a successful request
You received this error because your token is no longer valid.
Please, generate a new access token using the authentication endpoint with your client_id and client_secret.
Note that access tokens have an expiration time of 1 month. You must therefore make sure to manage the automatic renewal of your token.
More information about authentication can be found here.
The thing is that I am just integrating this APIs and have the token generated yesterday. I have tried to see where you passed the access token in your APIs but I could not find it in any of the APIs in the documentation.
I have used my discretion and passed it in my request header but still getting the error. I think what I want to hear from you is where the token should be added to the request. Where should I pass it in my request so that I can make a successful request. I am currently developing on my local machine and using the sandbox APIs.
You must pass it in your headers in the Authorization field.
Please make sure to add "Bearer " before the token as below:
GET https://api.sandbox.stuart.com/some_endpoint HTTP/1.1
Authorization: Bearer [token]
Host: api.sandbox.stuart.com
Several sample requests can be found in our [API documentation] (https://api-docs.stuart.com/). At the top of the page, you can select the language in which you want to make the request.
The access_code field is optional. You can use it if you want the courier to have a specific way of validating his tasks (pickup and/or drop-off). There are several types of access codes. Depending on the type of access code that you provide the courier may have to:
Scan a barcode or a QR Code
Show a barcode, a QR Code, or a text
Enter a code (e.g for accessing a building)
You can check out this article for more information.
Thank you for your response. I wish to inform you that I have effected the changes you recommended but I am still facing the same challenge. Below is the updated request payload:
{
"job": {
"pickup_at": "2023-02-23T011:00:00.000Z",
"pickups": [
{
"address": "32 Coombe Ln, Raynes Park, London SW20 0LA",
"comment": "Ask Bobby",
"contact": {
"firstname": "Bobby",
"lastname": "Brown",
"phone": 33610101010,
"email": "brown@gmail.com",
"company": "Pizza Shop"
}
}
],
"dropoffs": [
{
"package_type": "medium",
"package_description": "yellow package",
"client_reference": "ru483jejf98w",
"address": "23 Ethelbert Rd, London SW20 8QD",
"comment": "3nd floor on the right",
"end_customer_time_window_start": "2023-02-23T11:10:00.000Z",
"end_customer_time_window_end": "2023-02-23T02:00:00.000Z",
"contact": {
"firstname": "Julia",
"lastname": "Moore",
"phone": 33712222222,
"email": "moore@gmail.com",
"company": "findchow company"
}
}
]
}
}```
Please take a look at it and let me know what I should do better to make the request go through.
Thanks
For testing, you can use our postman collection. It is accessible in the header of our API documentation by clicking on the “Run in Postman” button (See the following screenshot).