Forum Discussion

msalvador's avatar
msalvador
Frequent Contributor
3 years ago

Oauth2 bearer

Hi guys, first of all, I hope to explain the issue in the correct way. I have 2 calls, one to retreive the jwt, the other one to do forge. In the second one in Aouth panel in  Access token field I...
  • msalvador's avatar
    3 years ago

    I solved with groovy script.

    Below the solution.

     

    import com.eviware.soapui.config.AuthEntryTypeConfig

    def authProfileName = "Bearer"
    def project = testRunner.getTestCase().getTestSuite().getProject()
    def authProfile = project.getAuthRepository().getEntry(authProfileName)
    //authProfile.setDomain ("newDomain")
    def accessToken = context.expand( '${Verify Token 2 - token - v4 Generazione JWT per Forge token#Response#$[\'accessToken\']}' )
    authProfile.setAccessToken(accessToken)
    //Set to true for pre-emptive authentication
    //Set to false for using global preference
    //authProfile.setPreemptive(true)

    def step = testRunner.testCase.getTestStepByName("Verify Forge - forge token - v4").getHttpRequest()
    step.setSelectedAuthProfile(authProfileName)