---
schema_version: "1"
id: 76da7f530c1bfba1dbd25ce4f4910e5188105087c03a223ac6d8942c4b205870
title: "Basic Authentication: Simple Policy"
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/gateway/1.9/policies-included-basic-auth-simple.md
canonical_url: https://docs.mulesoft.com/gateway/1.9/policies-included-basic-auth-simple
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 0f54b4a5ef71031519c5592775053cefa630e9225df6781de95432768fc7885d
description: MuleSoft Documentation Site
release: "1.9"
latest: false
---
---
product: Omni Gateway
version: 1.9
keywords: basic authentication, api gateway, flex gateway, gateway, policy
---

# Basic Authentication: Simple Policy

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

<table><colgroup><col> <col></colgroup><tbody><tr><td><p><strong>Policy Name</strong></p></td><td><p>Basic Authentication: Simple</p></td></tr><tr><td><p><strong>Summary</strong></p></td><td><p>Allows access based on the basic authorization mechanism, with a single user-password</p></td></tr><tr><td><p><strong>Category</strong></p></td><td><p>Security</p></td></tr><tr><td><p><strong>First Flex Gateway version available</strong></p></td><td><p>v1.0.0</p></td></tr><tr><td><p><strong>Returned Status Codes</strong></p></td><td><p>400 - Unauthorized or invalid client application credentials in WSDL API using SOAP 1.2</p></td></tr><tr><td></td><td><p>401 - Unauthorized or invalid client application credentials in HTTP or RAML APIs</p></td></tr><tr><td></td><td><p>500 - Unauthorized or invalid client application credentials in WSDL API using SOAP 1.1</p></td></tr></tbody></table>

## Summary

The Basic Authentication: Simple policy protects an API by forcing applications to provide a
username and password when making requests.

The policy follows
[basic HTTP authentication standards](https://datatracker.ietf.org/doc/html/rfc7617).

When an error is encountered, the policy returns an "WWW-Authenticate" HTTP header field.

## Configuring Policy Parameters

### Flex Gateway Local Mode

In Local Mode, you apply the policy to your API via declarative configuration files. Refer to the
following policy definition and table of parameters:

\- policyRef: name: http-basic-authentication-flex config: username: <string> // REQUIRED password:
<string> // REQUIRED

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Parameter</th><th>Required or Optional</th><th>Default Value</th><th>Description</th></tr></thead><tbody><tr><td><div><div><p><code>username</code></p></div></div></td><td><div><div><p>Required</p></div></div></td><td><div><div><p>N/A</p></div></div></td><td><div><div><p>A base-64 encoded string</p></div></div></td></tr><tr><td><div><div><p><code>password</code></p></div></div></td><td><div><div><p>Required</p></div></div></td><td><div><div><p>N/A</p></div></div></td><td><div><div><p>A base-64 encoded string</p></div></div></td></tr></tbody></table>

#### Resource Configuration Example

\- policyRef: name: http-basic-authentication-flex config: username: chris password: admin

### Flex Gateway Connected Mode

When you apply the Basic Authentication: Simple policy to an API, a request to that API must contain
the following header:

Authorization: Basic <username:password>

The `username:password` value must be a base64-encoded string. For example on a Mac OS X or Linux
system, the username and password requirement is implemented as:

`echo -n '<Client Id>:<Client Secret>' | base64`
