MuleSoft · HTTP Connector

HTTP:UNAUTHORIZED

Short answer

HTTP:UNAUTHORIZED means the server rejected the HTTP Request operation because authentication failed or was not provided (HTTP 401). Send the credentials the server expects, and handle the error type if a rejected call is something the flow should survive.

VerifiedLast verified

01Error text

MuleSoft error
Error type: HTTP:UNAUTHORIZED

02Likely causes

  • Authentication failed: the credentials sent with the request were not accepted by the server.
  • Authentication was not provided: the request reached the server without the credentials it requires.
  • For OAuth 2.0 configurations, no access token has been obtained yet. The docs list the related message No access token found. Verify that you have authenticated before trying to execute an operation to the API.

03How to fix it

  1. Confirm that the HTTP Request configuration sends the authentication the server expects, and that the credential values are current for this environment.
  2. Turn on HTTP wire logging to see the exact request and response: in log4j2.xml, enable the logger org.mule.service.http.impl.service.HttpMessageLogger at DEBUG level. Check that the authentication header is present in the outgoing request.
  3. If you use OAuth 2.0 and see the No access token found message, call the authorization URL at least once so a token exists, or store the token in an Object Store and refresh it.
  4. Handle the failure with an error handler of type HTTP:UNAUTHORIZED. Its parent type is MULE:CLIENT_SECURITY, which matches security errors produced by an external system.

04Official documentation

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

The iPaaS Brief

Subscribe to The iPaaS Brief.

The iPaaS newsletter for the people who run integrations. From iPaaS Group.

Free. You finish on theipaasbrief.com and confirm by email.