Tony Chatfield1
Kilo Patron

Hi, have you checked xml of the oauth_credential record? I suspect the token is stored in 'token_receive' in encrypted form?

Also looking at your GlideQuery for ‘oauth_credential’ you have no filtering so the query could potentially result in multiple results. I would include a query\filter for ‘oauth_requestor_profile’ and see if it works via decrypting token_receive, something like.

var oauthRef = new GlideRecord('oauth_credential');
    oauthRef.addQuery('peer', 'your_oauth_requestor_profile_sys_id');
    oauthRef.addQuery('type', 'access_token');
    oauthRef.query();
    if (oauthRef.next()) {
        var encr = new GlideEncrypter();
        var myToken = encr.decrypt(oauthRef.token_received);          
            
        // now create your REST your message and set the token IE myToken
   
    } else {    
        gs.info("No Token found for this Integration");
        }