Error when trying to generate Oauth token

Andrei Radules1
Giga Contributor

Hello, 

I am sometimes receiving the following error when trying to get a new Oauth Token via ScriptL

"

org.apache.commons.httpclient.HttpException: CertPathValidatorException
Invalid null response.: no thrown error
OAuthProblemException{error='Invalid null response.', description='', uri='null', state='null', scope='null', redirectUri='null', responseStatus=0, parameters={}}
*** Script: [DEBUG] null // access token
*** Script: [DEBUG] 0 // expiry time
*** Script: [DEBUG] null // refresh token

"

The script that I am using is:
"
var oAuthClient = new sn_auth.GlideOAuthClient();

var params = {grant_type:"password", username:'username', password:'password'};

var json = new global.JSON();

var text = json.encode(params);

var tokenResponse = oAuthClient.requestToken('OAuth_Final_Client', text);

var token = tokenResponse.getToken();

var access_token = token.getAccessToken();

var token_expires = token.getExpiresIn();

var refresh_token = token.getRefreshToken();

gs.debug(access_token);
gs.debug(token_expires);
gs.debug(refresh_token);

"

The weird thing is that sometimes it works, sometimes it does not, seems to be very inconsistent and random when it wants to work.

Any ideas ?

Thank you !
5 REPLIES 5