I’m trying to make some Stuart API requests and I keep getting an error:
message: “The access token was revoked”
I’m not sure what’s causing this problem, and so I’m unable to do anything with Stuart at the moment.
The access token has a 30 days duration, so it must be renewed when it expires.
You can find all the information you need here.
Notice that our client libraries already take into account our authentication process. We strongly recommend to use one of them and open a pull request if it is missing anything, we will be reactive to any of your PR.
Thank you @Harold,
I’ll let you know if I encounter any problems
Hello again @Harold,
I just tried to renew my access token by following the given instructions, but I’m still getting an error. When I send a post request to https://api.sandbox.stuart.com/oauth/token, with all the required info in the body i.e client_id, client_secret, grant_type and api; I get this error:
"error_description": "Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method."
Could you please assist me with this.
I think the error comes from the fact that the parameters should not be sent in the body, but in the header, as shown in the documentation:
curl --location --request POST 'https://api.sandbox.stuart.com/oauth/token' \
--data-urlencode 'client_id=[your_oauth_client_id]' \
--data-urlencode 'client_secret=[your_oauth_client_secret]' \
--data-urlencode 'grant_type=client_credentials' \
Could you try again this way please?
Thanks in advance,
I just tried placing them in the header, and I’m still getting the same error.
Would creating a new account help?
Could you check that you are targeting the correct environment:
If it is still not working, can you please give me the email address you are using?
Could you also give me an example of the request you are sending (without the client_id and client_secret) ?
Thanks in advance,
It finally worked. Turns out I was using production credentials for sandbox testing.
Thanks very much for the help!
Hello @Harold !
I’m using the Integrations Middleware https://middleware-docs.stuart.com
Unfortenatually i’m facing the mentioned error :
"message": "The access token was revoked"
while when i use
**(https://api.sandbox.stuart.com/oauth/token)** for the sandbox or
**https://api.stuart.com/oauth/token** for the production for example it works correctly
This would be because the Stuart API & integration middleware uses different access tokens.
You would need to use our POST - Get an oAuth2.0 access token endpoint while pointing to your desired integration middleware environment.
https://integrations.sandbox.stuart-apps.solutions/api/oauth/token or https://integrations.stuart-apps.solutions/api/oauth/token would be the correct URL depending on which environment you are requesting access to.
I hope this helps & please let us know if you require further assistance.
Please make sure you are using the sandbox client ID & secret found here Stuart, while pointing to the Integration Middleware sandbox environment https://integrations.sandbox.stuart-apps.solutions/api/oauth/token
Alternatively, please make sure you are using the production client ID and secret found here Stuart, while pointing to the Integration middleware production environment https://integrations.stuart-apps.solutions/api
Please let me know once you have retested and can confirm the correct credentials is in use and is pointing to the correct environment or if you have any further issues.
Hello Daniel !
Thank you for replying !
Can you explain to me the main difference between https://integrations.stuart-apps.solutions/api and https://api.stuart.com and what is your recommendation because it’s not clear in the documentation.
The Integrations middleware is a proxy of Stuart’s API which mirrors (proxies) its endpoints but intercepts certain endpoints to apply custom logic.
I would recommend using just the Stuart API, as you have the same capabilities required for your integration.
May I also ask why initially you wanted to use the middleware as this may help my recommendation?
Feel free to continue this discussion and provide details via direct messaging.