Setting Authentication in an API Automation Test Case Script
To ensure only authorized users or clients access the target API, use authentication to verify identity and permissions before granting access. Key functions include:
- Identity verification: Verifies credentials (such as a username and password) to ensure requests originate from an authorized user.
- Permission control: Checks whether a user has the permission to access specific resources or perform specific operations.
- API security: Prevents unauthorized access and protects sensitive data.
Authentication Methods
Select one of the following built-in authentication methods in API automation test case scripts, and configure verification information based on API requirements.
- No Auth: No authentication is required.
- Bearer Token: Includes the token in the request header using the format Authorization: Bearer <token>.
- API Key: Includes a predefined key in a request header or parameter, which the server validates upon receipt.
Setting Authentication in an API Automation Test Case Script
- On the page, click the name of the test case to be edited.
- Click the Scripting tab.
- Click
. - In the displayed dialog box, click the authentication mode drop-down list.
- Select one of the following modes and configure it by referring to the following information:
- No Auth: No authentication information is required.
- Bearer Token: Enter the authentication information in the token text box. Or use built-in functions, environment parameters, and local parameters. Up to 20,000 characters are supported.
- API Key: Enter a name and a value. Both support up to 20,000 characters. The name can contain only letters, digits, underscores (_), and hyphens (-). The value can use built-in functions, environment parameters, and local parameters.
- Click OK.
Setting Authentication in a URL Request
- On the page, click the name of the test case to be edited.
- Click the Scripting tab.
- On the bottom of the page, click URL Request to generate a test step.
- Click the Authentication tab.
- Select one of the following authentication modes from the drop-down list box:
- Inherit: (Default) Inherits the authentication settings of the API automation test case script set in Setting Authentication in an API Automation Test Case Script.
- No Auth: No authentication information is required.
- Bearer Token: Enter the authentication information in the token text box. Or use built-in functions, environment parameters, and local parameters. Up to 20,000 characters are supported.
- API Key: Enter a name and a value. Both support up to 20,000 characters. The name can contain only letters, digits, underscores (_), and hyphens (-). The value can use built-in functions, environment parameters, and local parameters.
- Click
on the top of the test step to save the configuration.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot