Forum Discussion
Is this still working for you? I'm seeing that AuthRepository is missing from the API docs. Looks like a lot of this has been deprecated. Have you found a work-around? (I can't even use the getAuthRepository() method).
Thanks in advance,
-James
Hi James, I am still using the same script and it works perfectly. Currently, I am on ReadyAPI 2.2.
Also, I do see Auth Repository tab under Auth Manager section.
What's version of SoapUI you are running?
for OS version, there is a small change:
import com.eviware.soapui.impl.rest.actions.oauth.OltuOAuth2ClientFacade import com.eviware.soapui.impl.rest.OAuth2Profile.* //Get Project def project = testRunner.testCase.testSuite.getProject() //Get oAuth2 Profile Name def authContainer def oAuthProfilelist def oAuthProfile def oAuthProfileName def TokenStatus def oAuthClientFacade def i = 0 //Get oAuth profile name list authContainer = testRunner.testCase.testSuite.project.OAuth2ProfileContainer oAuthProfilelist = authContainer.getOAuth2ProfileList() oAuthProfilelist.each{ oAuthProfileName = oAuthProfilelist[i].name log.info "oAuth Profile name is: $oAuthProfileName" //Get Token Status oAuthProfile = authContainer.getProfileByName("$oAuthProfileName") TokenStatus = oAuthProfile.accessTokenStatus.toString() log.info "Access Token Status for $oAuthProfileName is: $TokenStatus" //Get Access Token from the server if expired if (TokenStatus != 'Retrieved from server'){ oAuthClientFacade = new OltuOAuth2ClientFacade().requestAccessToken(oAuthProfile) log.info "Access Token Status is "+ oAuthProfile.accessTokenStatus } i++ }
- jameseg37 years agoNew Contributor
Thank you so much, this is working great.
- VenkateshM7 years agoOccasional ContributorHi,
I am having same problem. I tried with the script provided in this thread but still I am getting error msg like token expired unable to refresh. How you resolved this problem?- New2API6 years agoFrequent Contributor
Hi venkatesh, From project -> Auth manager -> Auth profile -- Check if you can retrieve token manually
I have attached that screen for your reference.
If you are able to retrive token manually then script should be able to do it for you.
Related Content
- 31 days ago
Recent Discussions
- 5 days ago
- 10 days ago