Forum Discussion

MrTea's avatar
MrTea
New Contributor
9 years ago
Solved

How to store a response of an Authorization token into OAuth2 Access Token

1)Send REST request with UserId and Password

2)Response is received with Authorization Token

3) I need to store the Authorization Token as the Access Token for OAuth2 automatically so I don't have to manually do it all the time, so I can continue with other method request.

 

Any suggestions? Any tutorial videos? How about point me in the right direction? 

 

3 Replies

    • MrTea's avatar
      MrTea
      New Contributor

      Thanks Rao for the response and it took me exactly to what I wanted to know.

      I will write back shortly with more detailed info.

      The basics are I get the AuthToken from the Json Response window using a groovy script

      in the same groovy script I write the AuthToken to a Global Property called GlobAccessTok

       

      but what I really wanted to do is put the AuthToken in the Authorization tab of the request for the next api I am going to use, under a Profile Name and put it in the Access Token text box for the Request.

       

      1)I use to do this manually sign in with username and password, send the request get the response

      2)Then manually copy the AuthToken from the response json window and then

      3)Go to my next method that requires the token, click on the Auth tab at the bottom of the request window

      4) Then Add a New Authorization from the drop down list

      5) Name the profile and paste the AuthToken in the Access Token text box and send that request

       

      I wanted to automate the above steps, I had hoped there was a couple of settings I could set in a groovy script that would do this for me but I am not sure.

       

       

  • nmrao's avatar
    nmrao
    Champion Level 3
    Please mention if you are using xml or json?
    How does the sample response look like?