Basic
You can use the Basic auth policy to protect HTTP Request flows with basic access authentication. Then, if someone sends a request to the flow, they must include a username and password in the HTTP headers of the request. If they don't, the request will be rejected.
This topic explains how to create and use a Basic auth policy.
Step 1: Create an auth policy
- Open a project.
- In the sidebar, click Auth policies.
- Click Add auth policy.
- In the Auth Policy Name field, enter a name for the policy.
- Select Auth Policy Type > Basic.
- In the Username field, enter a username.
- In the Password field, enter a password.
- Click Save.


Step 2: Assign the policy to a flow
- In an HTTP Request flow, open the Start (HTTP Request) component.
- From the Authentication dropdown, select the auth policy.
- Close the component's settings.
- Click Save.


Step 3: Send an unauthenticated request
Click the Run button.
The request should fail and the following error should appear in the Output tab:
Failed to pass auth policy. StatusCode: 401 Message: A Basic Authentication should be provided.
This confirms that the auth policy is enabled.


Step 4: Send an authenticated request
-
Convert the auth policy's credentials into a base64-encoded string. (This is a requirement of basic access authentication, not FL0.)
-
Concatenate the credentials into a colon-separated string:
admin:password
-
Use base64encode.org (or a similar tool) to encode the string:
YWRtaW46cGFzc3dvcmQ=
-
-
In the Input tab, create an
Authorization
header:Authorization
-
Set the value of the
Authorization
header toBasic
, followed by the encoded credentials:Basic YWRtaW46cGFzc3dvcmQ=
-
Click Run.
This time, the request should succeed.
Updated 8 months ago