Ask a Question

OAuth token value in AuthManager update form test (groovy)


OAuth token value in AuthManager update form test (groovy)

Hello all, 

I am using AuthManager in my project. But unfortunetally we implemented new dynamic part of the token. So I must refresh it after each new deployment. So for CI/CD is problem.

In my AuthManager I have token value. Now I can send my HTTP to get new one.. But remains question, how to update the value in AuthManager?


Any ideas? I saw some examples with update of the use name, etc.. but somehow this is not aplicable for me. 
I need just update the token value.


I dont know the object model.. And form some reason the ReadyAPI groovy step does not help me with syntax:

import com.eviware.soapui.config.AuthEntryTypeConfig;

def project = testRunner.getTestCase().getTestSuite().getProject();
def authProfile = project.getAuthRepository().getEntry("Name of your profile");

So  I have no idea what are all the available variables and methods in authProfile ...


Any idea wellcomed.


def authContainer = testRunner.testCase.testSuite.project.OAuth2ProfileContainer
def authProfile = authContainer.getProfileByName("admin_default")
def oldToken = authProfile.getAccessToken(); oldToken;
// updated
authProfile.setAccessToken("some"); authProfile.getAccessToken();


Can anybody tell me, why the helper dont know the setAccessToken method? When I am typing the code in groovy step?

I just found it by my sugesstion.. But IT MUST be somewhere descripted.. Like in object mode.. but I did not found it there..

It works.. but is stranght, that this was done by gessing...

Hey @vikititor,

I cant answer your question, but just wanted to say thanks for answering your query so quickly....i'm gonna completely steal your code for my own use, so thanks a lot! 😉

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta

Problem is, that is nowhere descripted.. the object model of ReadyAPI does not know the class neighter the methods.


I think, this is the problem.. I want to do something, but how??? :-DDD

I just tryed many variants.. and this works.. 

BTW the include rows are not necessary.. 

Showing results for 
Search instead for 
Did you mean: