Solved
Forum Discussion
Nastya_Khovrina
Alumni
8 years agoHi New2API,
To change the credentials you have set in the authorization profile (for the Client Credentials Grant type) you can use the following script in the Groovy Test Step:
import com.eviware.soapui.impl.rest.actions.oauth.OltuOAuth2ClientFacade import com.eviware.soapui.support.editor.inspectors.auth.TokenType def project = context.getTestCase().getTestSuite().getProject(); def oAuthProfile = project.getAuthRepository().getEntry("YourAuthProfile"); oAuthProfile.setClientSecret("Secret"); oAuthProfile.setClientID("Identification"); // the following code for getting new access token def oAuthClientFacade = new OltuOAuth2ClientFacade(TokenType.ACCESS); oAuthClientFacade.requestAccessToken(oAuthProfile, true);
demosoapuser
8 years agoOccasional Contributor
This one solved my question and I was able to set credentials dynamically on my api calls. Thank you very much. I wasn't able to reply immediately. Thank you again!