MuleSoft · Basic Authentication: Simple policy
401 Unauthorized or invalid client application credentials (Basic Authentication: Simple)
An API protected by the Basic Authentication: Simple policy returns 401 when the request has no valid Basic credentials. Send an Authorization: Basic header with the base64-encoded username:password that the policy is configured with.
VerifiedLast verified
01Error text
401 - Unauthorized or invalid client application credentials in HTTP or RAML APIs02Likely causes
- The request has no
Authorizationheader, or its credentials do not match the user name and password set in the policy.
03How to fix it
- Build the header value by base64-encoding
username:password, for example withecho -n '<user>:<password>' | base64. - Send it as
Authorization: Basic <encoded value>. - Check the user name and password against the policy configuration in API Manager.
iNotes
On error the policy returns a WWW-Authenticate header. WSDL APIs get 400 (SOAP 1.2) or 500 (SOAP 1.1) for the same condition.
04Official documentation
→Related errors
- HTTP:BASIC_AUTHENTICATIONHTTP:BASIC_AUTHENTICATION means a request did not carry basic authentication, or carried the wrong credentials. Send a valid basic authentication header with the request.
- 401 Unauthorized or invalid client application credentialsAn API protected by the Client ID Enforcement policy returns 401 when the client application's credentials are missing, invalid or not authorized. The client needs an approved contract for the API and must send matching credentials on every request.
- HTTP:UNAUTHORIZEDHTTP: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.
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