cancel
Showing results for 
Search instead for 
Did you mean: 

How to really get the OAuth 2 token automatically

SOLVED
Highlighted
Moderator

Re: How to really get the OAuth 2 token automatically

@BEdwards,

 

The script provided by you works fine for me in the Groovy Script test step

Also, the script provided by @Cekay works fine for me in the SubmitListener.beforeSubmit event

But, the Authentication profile should be set up correctly. 

 

Can you get the access token in the UI? It is expected that you see the browser. Can you successfully log in there?

 

After you retrieve the token once you will be able to automatically refresh it using the "Automation" script (using JavaScript on the screen with Pages). For example:

ReadyAPI_2019-05-10_17-44-31.png



Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
Occasional Contributor

Re: How to really get the OAuth 2 token automatically

Hey Nastya,

We don't have the resourse owners ID or password, so we have to use "Authorization Code Grant", there is no logon screen, it just pops up the code.  I want to grab that from the browser, place it in a variable and close the browser.  Not sure how to do that.

Highlighted
Moderator

Re: How to really get the OAuth 2 token automatically

@BEdwards So, your OAuth token is returned in JSON, not in the redirect URL. It seems that it's not fully supported by ReadyAPI now. 

I recommend that you open a new support case here: https://support.smartbear.com/message/?prod=ReadyAPI



Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Want a fun and easy way to learn ReadyAPI and show off your skills? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Compare an expected JSON value and actual response in Events

Participate!

Fetch value/data from JSON response using Groovy Script

See replies!

Filtering data retrieved from a DataSource

See replies!

Get data from Petstore and add it to Excel sheets

Participate!
Top Kudoed Authors