Forum Discussion

ochmanski's avatar
ochmanski
Visitor
9 years ago

how to do a Oauthv2 auth-code flow enable API with Testrunner

Smartbear Support,

 

I have configured an existing API in the SOAPUI pro 5.1.2 client.  It does a 3 legged oAuth v2 auth-code flow, then calls my REST API endpoint (with that authorization).  Also I configured the oauth automation tab (under the oauth entry) to do the human login.

 

It works fine in the SOAPUI UI. (click on the test steps and play button), it does the oauth (with human login - scripted in "automation tab" of the oauth profile), then does API call with bearer token.  (working fine.)

 

Not working:    I want to test availability of the API, via testrunner calls (on timer) and to run this SOAPUI project from Command line (via testrunner).  This testrunner is run via a continuous integration server (like jenkins) and runs unattended (on timer)

 

Assuming I didn't run in the UI first:  then testrunner fails to do the oauth (that is already configured in the project) and therefore fail auth on the API. 

 

If I run in via play button the the UI first (then use the "lauch testrunner" before token expired is works.

 

I suspect your "automation tab scripts" are not being used in testrunner, even though I checked the "enable UI components in scripts" box. so a "new authorization is not working but and existing one is". (my guess).

 

 

Any suggestions?

 

Steve Ochmanski

 

1 Reply

  • dgrandfield's avatar
    dgrandfield
    New Contributor

    ochmanskiLet me start by saying that i'm sorry to see that you have not gotten an answer to this.  Let me finish by asking how you setup to perform 3-legged oauth.  I need to do the same here and cannot seem to find where anyone else has accomplished this.  Trying for Groovy script now but sadly not many functional examples.  I have been able to complete the first leg using the Automation Scripts in the auth profile but the code is simply displayed in an otherwise blank page in the readyapi browser.