This tutorial explains how to enable OAuth 2.0 authorization for a REST request.
To configure OAuth 2.0 authorization, you need to:
Create and configure an authorization profile.
Retrieve an access token.
1. Add an Authorization Profile
First, you need to add an OAuth 2.0 authorization profile:
Open a REST request.
Open the Auth panel.
Click Add Authorization Profile.
In the resulting dialog, select the OAuth 2.0 type and enter the profile name. Click OK.
2. Configure Authorization
Configure OpenID Connect
If your web service uses OpenID Connect, you can also retrieve the
id_token value from it. You can do this for the following approaches:
id_token value is sent in different types of parameters. You can manually assign it to any parameter. To do this, first, get it by using a Groovy Script test step with the following code:
def idToken = authEntry.getIdToken();
Then, use property expansions to transfer the token to your requests, for example:
After You Configure Authorization
OAuth 2.0 tokens can change from time to time. To avoid the need to update them manually, you can configure ReadyAPI to check if a token is up-to-date before sending a request and retrieve the token automatically. For more information about automating token retrieval, see the Automating Token Retrieval section.