MuleSoft · OAuth 2.0 Access Token Enforcement Using Mule OAuth Provider policy
400 Invalid token
An API protected by the OAuth 2.0 Access Token Enforcement Using Mule OAuth Provider policy returns 400 when the access token is invalid. Request a new token from the provider and send that one.
VerifiedLast verified
01Error text
400 - Invalid token02Likely causes
- The access token sent with the request is invalid.
03How to fix it
- Obtain a new access token from the Mule OAuth provider.
- Check the Scopes and Scope Validation Criteria settings in the policy against the scopes of the token.
- Repeat the request with the new token.
iNotes
The same policy returns 401 for "Unauthorized access or error when connecting to the authorization server" and 500 for "Bad response from authorization server, or WSDL SOAP fault error." If the validation endpoint rejects the policy's requests, the docs say to check that the URL is reachable from the machine running the policy and that the endpoint needs no authentication.
04Official documentation
→Related errors
- 403 Forbidden, invalid client application credentialsAn API protected by the OAuth 2.0 Access Token Enforcement Using Mule OAuth Provider policy returns 403 when the client application credentials behind the token are invalid for this API. Use a token issued to a client application that has access to the API.
- 401 from the JWT Validation policyAn API protected by the JWT Validation policy returns 401 when the token's signature is invalid, a required claim is missing or fails validation, or the token cannot be parsed. Compare the token with the policy's signing method, key and claim settings.
- No access token foundNo access token found means an HTTP request with OAuth 2.0 authentication ran before any access token had been obtained. Call the authorization URL at least once first, or store the token and refresh it.
Test every fix in a non-production environment before you apply it to production. See how entries are verified.
More for MuleSoft work:Open MuleSoft jobsMuleSoft rates and salariesHire a senior MuleSoft developer