Legacy Documentation
You're viewing legacy documentation for API Fortress (deployed via an on-premises container). To view documentation for the new SaaS version of API Fortress — now known as Sauce Labs API Testing and Monitoring (with Sauce Connect tunnels) — see API Testing on the Sauce Labs Cloud.

Dealing with Authentication (Simple, oAuth, etc)

Introduction

API Fortress can handle nearly any authorization scheme. Below, we provide some guides on simple ways to work with the most common authorization methods. If it requires usage of a long lasting token, see here for more information.

Simple Authorization

  1. Enter the visual composer
  2. Click Add Component
  3. Click POST (or whatever REST method the authentication server is expecting)
  4. Enter details and then click Add Authentication
  5. Choose Basic
  6. Enter the Username and Password

basic_auth

The header information is automatically encoded and entered for you!

2

Next, we parameterize the token that we receive in the response.

  1. First, select the Set (variable) component
  2. Next, enter the name that you would like to use for the variable as Var
  3. Enter the value of the token itself as Value
  4. Add a Comment component with the previously set variable as the Value to see the token logged!

From here, we can use the token in follow-on prompts by referencing its variable name.

parameterize

Here’s the process in video form!

Simple Authorization from the HTTP Client

Using the HTTP composer requires encoding the Username and Password yourself.

  1. Click on Tools > HTTP Client
  2. Click on Tools > Gadgets
  3. Choose base64-encode
  4. Type in the username and password like this with the semicolon “username:password”
  5. Click encode
  6. Copy the generated code (our example is VXNlcm5hbWU6UGFzc3dvcmQ=)
  7. Now use that generated code in your call. Specifically as a Header, and use the word “Basic” under key, and the generated code (VXNlcm5hbWU6UGFzc3dvcmQ=) for value.

http

That’s it! The call should work now. If not feel free to send us a message at support@apifortress.com!

2 legged, 2-leg

oAuth/Token Exchange

  1. Enter the visual composer
  2. Click Add Component
  3. Click POST (or whatever REST method the authentication server is expecting)
  4. Enter details and add parameters or POST body
  5. In our example its a POST body with username and password


Next, we parameterize the token that we receive in the response.

  1. First, select the Set (variable) component
  2. Next, enter the name that you would like to use for the variable as Var
  3. Enter the reference to the token from the previous payload as Value
  4. Add a Comment component with the previously set variable as the Value to see the token logged!
  5. From here, we can use the token in subsequent API calls by referencing its variable name.