ContributionsMost RecentMost LikesSolutionsRe: how to automate our manual Oauth2.0 process. ? SubmitListener.beforeSubmit -> with the script works like charm. I need to tweek authProfile to get custmoized name. It works now. thanks all, appreciate all your input Re: how to automate our manual Oauth2.0 process. ? I have gone through above board. I have OAuth 2 'Client Credentials Grant'. So I can add the script above the <con:clientID> as '<con:javaScripts> <con:entry/> <con:entry/> </con:javaScripts>'. But my questio as follows, 1) adip01 : dosent mention what kind of script is in place and where it is 2) I tried having 'Automation' and script as givien in https://support.smartbear.com/readyapi/docs/projects/requests/auth/types/oauth2/automate/sample.html NOTE: Token auto refresh is not turned on, So requirement is to get new token on expiration. No luck, any help is appreciated. Re: Auto Token Generation for OAuth2.0 Hey, I have question on AUTO generating toke on expiration. Created discussion https://community.smartbear.com/t5/SoapUI-Pro/how-to-automate-our-manual-Oauth2-0-process/m-p/183496#M41955 As suggestion I tried implementing 'TestRunListener.beforeRun' with given script and no luck. My token have pretty much good expiration, to test auto generation I screw up exisitng token and test them automation. It works when I manually update token (Generate Token) READY API 2.6.0 NOTE: AUTO REFRESH of my token is not set, so I need to create new toke when its expired. Any help is highly appreciated. Re: how to automate our manual Oauth2.0 process. ? Thanks for reply,I tried adding 'TestRunListener.beforeRun' event and got below error ERROR: Exception in request: java.lang.RuntimeException: Unable to refresh expired access token. ERROR: An error occurred [Unable to refresh expired access token.], see error log for details INFO: Error getting response for [http://my-service-dev.apps.proj.com.ProcessActionWithData:Request 1]; java.lang.RuntimeException: Unable to refresh expired access token. AutoRefresh is not set on token, so I need to create new token if its expired. Any handly code would be great. Thanks, how to automate our manual Oauth2.0 process. ? READY API 2.6.0 I am trying to automate token retrival part of my REST URI call. I am successful in generating OAUTH2.0 (client crential) token manually 'Get Token' I am following Javascript and Groovy scripts https://support.smartbear.com/readyapi/docs/projects/requests/auth/types/oauth2/automate/sample.html Under Page 1: I got Java script for Authorization. try adding consent screen in Page 2 I tried Groovy script in Page 3 (whcih suppose to retrive token if its expired) Getting below error on Page 3 ---------------------------------------------------------------------------------- The following script is invalid: // Import the required classes import com.eviware.soapui.impl.rest.actions.oauth.OltuOAuth2ClientFacade; import com.eviware.soapui.support.editor.inspectors.auth.TokenType; import com.eviware.soapui.model.support.ModelSupport; // Set up variables def project = ModelSupport.getModelItemProject(context.getModelItem()); def authProfile = project.getAuthRepository().getEntry("OAuth 2"); def oldToken = authProfile.getAccessToken(); def tokenType = TokenType.ACCESS; // Create a facade object def oAuthFacade = new OltuOAuth2ClientFacade(tokenType); // Request an access token in headless mode oAuthFacade.requestAccessToken(authProfile, true, true); // Wait until the access token gets updated while(oldToken == authProfile.getAccessToken()) { } //The sleep method can be used instead of a while loop //sleep(3000); // Post the info to the log log.info("Set new token: " + authProfile.getAccessToken()); Error: missing ; before statement (scriptToValidate#2) -------------------------------------------------------------------------------------------------------------------- # Attached screen shot. I am sure, something silly I am missing. Appreciate help SolvedGetting blank project imported when attempt to open saved REST project (.xml) Created new Project with one REST API functional testing (POST API to get token). File -> Save All Proejct and stored xml locally. Exit Ready API and reopen it and try import project and pick the XML give me blank project as shown in attachment. READY-API- 2.6.0 (Licensed) SolvedRe: Observed missing_grant_type error in API response , when application/x-www-form-urlencoded used Works like charm. Thanks divyarani Re: Re: how to pass data in the form of x-www-form-urlencoded Hey guys, any luck on getting to know the format to be sent for 'application/x-www-form-urlencoded' ?? HAving same issue on getting token by passing body with below format grant_type=client_credentials&client_id=123456&client_secret=789000 Even tried with single annd double quotes for variables and no luck. Aprreciate quick help Re: Observed missing_grant_type error in API response , when application/x-www-form-urlencoded used I do have similar problem when I try to get tokeb using Media-Type : 'x-www-form-urlencoded' and below is my format grant_type=client_credentials&client_id=123456&client_secret=789000 No Luck. ITs REST POST CMD withh body of type 'x-www-form-urlencoded'. It works perfect in POSTMAN. Would like to know what is the format need to be sent along the body of type 'x-www-form-urlencoded' to get token. Appreciate quick help