Use Access Token on the header of Rest Message Call

Vincenzo Basile
Tera Expert

Hi All,

I need to set on the header of a Rest message a variable that store the AccessToken.
Now, that value is stored on the table "oauth_credential", in the field "token_received" that is a "password2" field.

 

I have thinked to a script that using the GlideEncrypter recover this information,

but, there are a standard way to recover the token  and so use it on the Rest Call?

 

Regads

Vincenzo

1 REPLY 1

Anand Kumar P
Giga Patron
Giga Patron

Hi @Vincenzo Basile ,

Try with below script

var OAuthClient = new GlideRecord('u_oauth_client');
if (OAuthClient.get('c09a2bd60fccf6008e2a4b9ce1050e56'))   {
  var encrypter = new GlideEncrypter();
  var clientSecret = encrypter.decrypt(OAuthClient.u_secret);
  gs.print(clientSecret);
}

Thanks,

Anand