Notifications

260 views

Description

Symptoms


After Kingston release,  Get OAUth token is throwing the error " "OAuth flow failed. Verify the configurations and try again. Error detail:invalid_request, Missing parameters: access_token" 

Testing from POSTMAN is not throwing any error and getting the proper token

Cause


Add the log statements in the script include "OAuthUtil"  and see the response

gs.log("accessTokenResponse.getContentType()===>" +accessTokenResponse.getContentType()); 
gs.log("accessTokenResponse.getBody()====>" +accessTokenResponse.getBody()); 

 

Results:

2019-07-12 12:14:45 
Information accessTokenResponse.getContentType()===>null *** Script 

2019-07-12 12:14:45 
Information accessTokenResponse.getBody()====>{ 
"access_token" : "123123123123", 
"token_type" : "Bearer", 
"expires_in" : 86400 

 

Here we can see the Content Type is getting as NULL which is throwing the error based on the IF condition in the "OAuthUtil"

Resolution


Comment out the below IF condition can fix the issue:

//if (contentType && contentType.indexOf('application/json') != -1) { 
var tokenResponse = (new global.JSON()).decode(accessTokenResponse.getBody()); 
var paramMap = accessTokenResponse.getparameters(); 
for (param in tokenResponse) 
paramMap.put(param, tokenResponse[param].toString()); 
//} 

 

So, to the fix the issue you can extend this script include and overwrite this function with these lines commented out OR create a new script include "OAuthUtilClient" copy paste the code from script include "OAuthUtil" and comment out the lines 

Article Information

Last Updated:2019-08-21 03:40:10
Published:2019-08-21