Automating Access Token Retrieval

NOTE: This page contains information on standalone SoapUI Pro that has been replaced with ReadyAPI. To try automated access token retrieval, feel free to download a ReadyAPI trial from our website.

Automated Token Editor

The Automated Token Editor lets you add scripting to automate retrieval of OAuth 2 tokens, by creating javascript interactions with the authentication pages provided by the authentication server.

How it works

For each page involved in the authorization process, you add a corresponding field in the editor.

In each field you put javascript code, that perform the authorization actions required for that page.

The script in a field is run when a page is opened in the browser.

Note: The automation doesn't care what the pages are called, it only grabs them in order. If you need to ensure that you are on the proper page for some reason, it has to be handled inside the scripts.

Automated Token Editor

Automated Token Editor

# Icon Item Description
01 Test Scripts Test Scripts Run the automation (to try it out)
02 Add field Add field
03 Delete field Delete field
04 Script area Enter script here
05 Field area Click here to select field
06 Help link Link to more information

Adding field

  1. Click on the add script field add script field button.

Delete field

To delete a page:

  1. Click on the page frame to select it.
  2. Click on the delete script field delete script field button.

Reorder fields

Note: Currently, fields cannot be reordered, only added and deleted. If you need to insert a new page before another, copy and paste the scripts between the pages instead.

Syntax check

When testing the scripts, the editor will warn you if the code you have entered is not formatted correctly:

Automated Token Editor

Browser error

The browser will also display any errors returned by the authorization server.

Sample Browser Error: Google

Validation error

If the script cannot be validated for some reason, you will get an error message.

Validation Error

The error message is only a suggestion, and the error may elsewhere.