Enabling OAuth 2.0 Authentication

This tutorial explains how to enable OAuth 2.0 authorization for a REST request.

Overview

To configure OAuth 2.0 authorization, you need to:

  • Create and configure an authorization profile.

  • Retrieve an access token.

1. Add an Authorization Profile

  1. Open a REST request.

  2. Open the Auth panel:

    OAuth 2.0: Auth Tab
  3. Click Add Authorization Profile:

    OAuth 2.0: Adding Authentication Profile
  4. In the resulting dialog, select the OAuth 2.0 type and enter the profile name. Click OK:

    OAuth 2.0: Add Authentication Dialog

2. Configure Authorization

After you add the authorization profile, you need to get an access token from the server. In this tutorial, you get it by using the Authorization Code grant type:

  1. Expand the Get Access Token drop-down list.

  2. Specify the authorization data. For a reference on the required parameters, see the OAuth 2.0 Grant Types section.

    Note

    You can add additional parameters to the OAuth 2.0 access token request by enabling Additional Parameters. ReadyAPI appends the custom name–value pairs to the request body and supports property expansion.

  3. Click Get Access Token:

    OAuth 2.0 Get Access Token dialog

ReadyAPI retrieves the access token from the server and displays it in the Access Token field:

OAuth 2.0: Access Token retrieved from server

Note

From version 3.42, you can use and insert Property Expansions in the Authentication types by using the Get Data menu.

Insert Property Expansion
Insert Property Expansion

After You Configure Authorization

OAuth 2.0 tokens can change from time to time. To avoid the need to update them manually, configure ReadyAPI to check whether a token is up to date before sending a request, and to automatically retrieve the token. For more information about automating token retrieval, see the Automating Token Retrieval section.

See Also

Publication date: