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.
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.
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.
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?
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.
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?
Get a full Raw JMS request
Compare an expected JSON value and actual response in Events
Fetch value/data from JSON response using Groovy Script
Get data from Petstore and add it to Excel sheets