Depending on the type of authentication or authorization required by your API, you can add auth settings at the test, flow, and request level for an API test. mabl supports the following authentication types for API tests:
- API key
- Basic auth
- Bearer token
- OAuth 1.0
- OAuth 2.0
If you need support for additional authentication types, please let us know via the mabl Product Portal.
Test-level auth
To apply auth settings to all requests in an API test, take the following steps:
- Click on the "Edit test properties" pencil in the top-left corner of the API Test Editor.
- In the edit test modal, select the authentication method that the API requires.
- Enter auth details as required by the API.
- Close the edit test modal.
Adding test-level auth
Flow-level auth
The default auth setting for all flows is "Inherit from parent". If a different option is selected, flow-level auth settings override test-level auth settings.
To apply different auth settings to all requests in an API flow, take the following steps:
- Click on the pencil to edit the flow in the API Test Editor.
- In the Auth tab, select the authentication method that the API requires.
- Enter the auth details as required by the API.
- Close the edit flow modal.
Adding flow-level auth
When you update flow-level auth in one test, you update the auth across all instances of the flow in your workspace.
Request-level auth
The default auth setting for all requests is "Inherit from parent". If the auth settings at the request level use a different method, the request-level auth settings will override the flow-level or test-level auth settings.
To apply auth settings to a specific request in an API test, open the test in the API Test Editor and take the following steps:
- In the step builder for a given request, click on the Auth tab.
- Select the authentication method that the request requires.
- Enter auth details as required by the API.
Adding request-level auth
Auth settings in Postman imports
If you imported a Postman collection with auth settings, check out this article to learn more about how auth settings are imported from Postman.