All Products
Search
Document Center

Function Compute:Configure Basic authentication for an HTTP trigger

Last Updated:Apr 01, 2026

Basic authentication lets you restrict access to your HTTP trigger with usernames and passwords. Function Compute checks the Authorization header for valid Base64-encoded credentials before invoking the function, so only clients with matching credentials can reach it.

Warning

Basic authentication transmits credentials in Base64 encoding, which is not encryption. Always use HTTPS in production. HTTP is for development and testing only. Function Compute is not responsible for credential leaks caused by using HTTP.

Prerequisites

Before you begin, ensure that you have:

Limits

ConstraintDetails
Max users per trigger20
Username length12–128 characters; must follow FC resource naming conventions
Password length12–128 characters; must contain uppercase letters, lowercase letters, digits, and at least one of: ! @ # $ % ^ & * ( )
Password uniquenessEach user must have a unique password; avoid common or weak passwords
Credential managementFunction Compute only stores and verifies credentials. Rotate passwords that are compromised, considered insecure, or have been in use for a long time

Configure Basic authentication

  1. Log in to the Function Compute console. In the left navigation pane, choose Function Management > Functions.

  2. In the top navigation bar, select a region. On the Functions page, click the target function.

  3. On the function details page, click the Triggers tab. In the Actions column of the HTTP trigger, click Modify.

  4. In the Modify Trigger panel, configure the following settings and click OK:

    • Set Authentication Method to Basic Authentication.

    • Under Users, enter a Username and Password.

    image

Verify the configuration

Use cURL to confirm that the trigger rejects unauthenticated requests and accepts valid credentials.

  1. On the Triggers tab, copy the public endpoint of the HTTP trigger.

  2. Base64-encode your credentials:

    echo -n "username:password" | base64
  3. Send an authenticated request using the encoded value:

    curl -X POST "https://example.com" \
      -H "Authorization: Basic YmFzaWMtYXV0aGVudGljYXRpb246MTUyMkBaaHV6aTV6****="

    Replace https://example.com with the public endpoint from step 1. The Authorization header value must start with Basic followed by a single space, as required by RFC 7617.

FAQ

Why does the trigger return "authorization required" after I enable Basic authentication?

The request is missing a valid Authorization header. Check that the header is present and that the Base64-encoded credentials are correct.

Why does the trigger return "Authorization header must start with Basic"?

Per RFC 7617, the Authorization header value must start with Basic followed by a space. Check that your request includes the correct prefix before the encoded credentials.

Are there extra charges for enabling Basic authentication?

No. Gateway-related features in Function Compute are included in function invocation charges.