Forum Discussion

RB17's avatar
RB17
New Contributor
8 years ago

How to run test case without clicking Get Access Token button in the oauth2 authorization profile?

I created oauth2.0 code authorization grant profile to get access token from server for a REST request. But when I run test case without clicking "Get Access Token", test request throws error "Authentication failed". How can I automate test case with access token automatically

3 Replies

    • RB17's avatar
      RB17
      New Contributor

      Hi Natalie,

       

      The automation for entering browser credentials is already done. My question is I could not run the test case successfully without clicking on "Get access token" as shown in the screenshot

       

      • rlong98's avatar
        rlong98
        Contributor

        Agreed there is no solution that I have seen to automate the OAuth2 for Salesforce.  I tried all the so-called scripts and tricks that people have posted, even SmartBear solution of "Automation" in the OAuth2

         

        WHAT HAPPENS:

        1.  We have to click on "Auth" tab

        2.  Click on "Get Access Token"

        3.  Click on "Get Access Token" again

        4.  Wait for SoapUI Browser to open to manually enter in the data and click "Login to Sandbox"

        From there we now can run all the Requests

         

        WHAT WE WANT:

        a.  A solution for the Automation section in the "Get Access Token" section > Automation... Button where you can put a page 1 or page 2 script.  (none of the online examples worked for Salesforce)

        or

        b.  A Groovy way to do the above

        or

        c.  To Generalize - we don't want to have to manually do the above 1-4 steps

         

        Thank you,

        Rob Long

         

        Anyone who finds this solution will be a hero!  No one has gotten this to work that I have searched.