How to extract the access token from the 'Auth' tab and transfer it to the other requests in header?SOLVED
How to extract the access token from the 'Auth' tab and transfer it to the other requests in header?
I want to get the generated Access Token from the Auth tab and use it as a property for other tests. (Require to pass the access Tokens as the header for all the test steps). I want to avoid doing it manually for all the test steps.
Is it possible for me to achieve that?
Note: The access Tokens are not generated in the response. I'm using OAuth 2.0 and the tokens are getting generated in the Auth Tab.
Attached is the screenshot for more reference.
Solved! Go to Solution.
This post will help me to apply the authorization rules to all the requests, but this will not help me to create tokens at the same time. I will have to manually get the tokens every time.
Apologies for my late reply, i got sidetracked with some personal stuff.
Unless someone else has a nifty idea, i think you have 2 choices here. As the access token isn't available via a request/response's raw request/response content you need another option.
I tested a system that used OAuth v2.0 last year, but it had been customised so much that the embedded OAuth functionality in ReadyAPI! didn't work so i had to setup all the individual requests that comprise the back and forth that makes up the OAuth v2.0 auth which allowed me to do what you need to extract the access token to save it to a property. This option would allow you to do what you need, but it did take a lot of effort to automate the whole thing. Obviously i can understand how you wouldnt want to adopt this approach considering youve already got your OAuth setup already.
2nd option i can think of is if you raise a support call with Smartbear and see if they can advise how to extract the token value (its got to be persisted in a variable somewhere under the covers, right?) considering it doesnt look like anyone on the forum can help at this point....??
Sorry i cant be of more help,
Thank you so much for your reply!
One more thing, you have mentioned that you have set up all the individual requests that comprise the back and forth which helped you to extract the access token and save it in a property. How did you do that?
Though I have the OAuth setup already, I would like to automate the below steps sequentially.
1)The clicking of 'Get Access Token' Button
2) Entering the login credentials on the login page of application.
3) Extracting the verification code from outlook and entering on the next page after login.
4) Extracting the access token and adding it in the header.
And yes I will try the second option too.
Hi @Jagruuti , I see you are working with the Support Team on this - please let us know when you get the solution! Thank you.
Community and Education Specialist
Hi @sonya_m ,
I have still not got the solution. I will post it once I get the solution from the Support team or from some of the findings.
Thanks and Regards,
Support Team has provided with the answer 🙂
While using OAuth 2 flow, you need to select the checkbox of 'Use Authorization Header' as shown in the attached screenshot. Then, you don't need to add the token in the Headers tab Ex. Authorization: Bearer [Access Token]. After that, you can use the Auth Manager and select the respective OAuth 2 profile for your requests.
- « Previous
- Next »
- « Previous
- Next »