How to extract the access token from the 'Auth' tab and transfer it to the other requests in header?
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Labels:
-
Data-Driven Testing
-
REST
-
Scripting
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
https://support.smartbear.com/readyapi/docs/requests/auth/types/oauth2/automate/sample.html
https://support.smartbear.com/readyapi/docs/requests/auth/types/oauth2/automate/about.html
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @nmrao,
I tried automating it also, I was getting an error as shown in the 'Script failure error' attachment. Also please find the below code snippet in the other attachment.
I tried using the below code, which I think was correct. Or can you explain me which code should be added so that I can automate the manually generated token process? or is this the application related issue? Because manually the token was getting created.
Also, I discussed this with one of the developer in our team, he suggests this might be a configuration issue at the SOAP UI end while doing automation.
Regards,
Jagruuti
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Im getting a 404 when i try downloading the .png files you attached.
Can you please either reattach or embed the details directly into your post instead?
Also. Just so we're nice and clear. You have your OAuth v2.0 setup correctly via the Auth tab on your resource or method and you want to extract the token value from this?
Nice one,
Rich
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Jagruuti
I'm getting a 404 when I try and download either of the code snippet or error .png files you attached.
Could you please either reattach or embed the contents directly into your post please?
I've never seen any attachments generate a 404 on this forum. Is the upload process being blocked by an internal firewall at your end?
Nice one
rich
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @richie ,
I'm attaching a word document from my end having both the screenshots. Please check if you can access it.
I'm changing the Subject name to be more clear. And also I have added one screenshot in the description.
Thanks,
Jagruti Wani
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Im struggling to understand the problem now.
Im looking at your code snippet and it looks like its a java snippet to login to a webapp front end? Im obviously missing something.
You originally mentioned that you wanted to extract the token value from the auth tab, but youve lost me now cos, well....each request can use the token cos youve setup the OAuth correctly.
Nice one!
Rich
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @richie ,
If you can see my subject's description, you can understand it better.
I want to use the OAuth token in the header for more than one request and I want to avoid doing it manually.
** The code that I have written was for automating it. When I run the script, I'm taken to the login page of my application where I have to enter the credentials and after login, a security number will come in my inbox which I have to enter it on the next page, then the access token will get generate.
*I wanted to avoid doing it manually every time because the session time is limited for this access token.
*Also, I want to use this access token in the header of the other requests or the test steps, which also I want to avoid doing it manually.
Is my problem clear now? Or do you need more details?
Regards,
Jagruti Wani
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please see below documentation to see if that is helpful
https://support.smartbear.com/readyapi/docs/requests/auth/index.html
Regards,
Ghulam
