There are a few common OAuth 2.0 errors that we will explain below:
1. 401 Unauthorized Error: “error":"Unauthorized","message":"Bad credentials"
Fix: You are trying to get an OAuth token (/oauth/token) with the wrong credentials. Please check your credentials and try again.
2. 401 Unauthorized Error: “status": "UNAUTHORIZED", "message": "You are not authorized to perform this action."
Fix: You are using the correct credentials, but accessing an endpoint you do not have permissions for with your current role. Please check your permissions and our user guide on the subject.
3. 401 Unauthorized Error: "error": "invalid_token", "error_description": "Cannot convert access token to JSON."
Fix: You are trying to hit our sandbox server with production server credentials or vice-versa. Please change the url to the correct domain https://[api].hydrogenplatform.com or https://[sandbox].hydrogenplatform.com
4. 401 Unauthorized Error: "error": "invalid_token", "error_description": "Access token expired."
Fix: You are trying to use an expired access token. These tokens expire every 24 hours. Please make sure you refresh the tokens.