Forum Discussion
Hello avidCoder,
The easiest way to get an access token programmarically in ReadyAPI is:
1. Configure the OAuth 2.0 profile for a request and make sure that you can retrieve the token manually.
2. If the selected flow requires some interaction with the internal browser, add the corresponding JavaScript code to the "Automation..." section to automate this interaction.
3. Add the Groovy code which accesses the configured OAuth profile and runs the token retrieval method.
Step #2 and #3 are described in details in this article: https://support.smartbear.com/readyapi/docs/projects/requests/auth/types/oauth2/automate/sample.html
- Olga_T6 years agoSmartBear Alumni (Retired)
Hi all,
NBorovykh, thank you for sharing your expertise!
avidCoder do the above steps work for you? Or, do you have any additional information for us?
We are looking forward to hearing from you,- avidCoder6 years agoSuper Contributor
Yes, I found the solution for my query. I used springframework code to implement this. And it was just 6-7 lines of code. Thanks for the support.
- ashrey6 years agoNew Contributor
Hello,
Am also looking for a solution to implement the access token.
I have the rest api which returns the access token. now i want to call that rest call in java inorder to get the access token, by passing grant type, username and password.
https://example.com/oauth2/token is the uri.
Coud you please share the piece of code or help me out with this how to achieve.
Thanks for your support,
Ashrey
Related Content
- 2 years ago