Script to retrieve Access and Refresh tokens using GlideOAuthClient librariesSummary<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Below is sample script Script to retrieve Access and Refresh tokens using GlideOAuthClient libraries This could be run from background scripts for testing purpose Release<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } All releases Instructions<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Code to retrieve Access token and Refresh Token:var oAuthClient = new sn_auth.GlideOAuthClient();var requestor_context = 'test';var requestor_id = 'abc@xyz.com';var oauth_profile_id = '43d6bab3db849f009a6ff9b61d961957'; // profile ID [sys_id of 'OAuth Entity Profiles' (oauth_entity_profile) record in OAUTH registry record]var params = {grant_type:"password", username:'admin', password:'pwd', oauth_requestor_context:requestor_context, oauth_requestor:requestor_id, oauth_provider_profile:oauth_profile_id}; //var json = new global.JSON();var text = json.encode(params);var tokenResponse = oAuthClient.requestToken('oAuth Test', text); //'oAuth Test' is the name of the OAuth application registry record (oauth_entity)var token = tokenResponse.getToken();var access_token = token.getAccessToken() ;gs.log("AccessToken:" + access_token);gs.log("AccessTokenExpiresIn:" + token.getExpiresIn());gs.log(" RefreshToken:" + token.getRefreshToken());Code to retrieve a new Access Token using Refresh tokenvar oAuthClient = new sn_auth.GlideOAuthClient();var requestor_context = 'test';var requestor_id = 'abc@xyz.com';var oauth_profile_id = '43d6bab3db849f009a6ff9b61d961957'; // profile ID [sys_id of 'OAuth Entity Profiles' (oauth_entity_profile) record in OAUTH registry record]var params = {grant_type:"refresh_token", refresh_token:"<value_of_refresh_token>", oauth_requestor_context:requestor_context, oauth_requestor:requestor_id, oauth_provider_profile:oauth_profile_id};var json = new global.JSON();var text = json.encode(params);var tokenResponse = oAuthClient.requestToken('oAuth Test', text); //'oAuth Test' is the name of the OAuth application registry record (oauth_entity)var token = tokenResponse.getToken();var access_token = token.getAccessToken() ;gs.log("AccessToken:" + access_token);gs.log("AccessTokenExpiresIn:" + token.getExpiresIn());gs.log(" RefreshToken:" + token.getRefreshToken()); Making an outbound REST call with the retrieved token // make the outbound REST call with the retrieved token var r = new sn_ws.RESTMessageV2('empukemburu03_outbound', 'Default GET'); //setting oauth profile and oauth requester profile r.setAuthenticationProfile('oauth2', oauth_profile_id); r.setRequestorProfile(requestor_context, requestor_id); var response = r.execute(); var responseBody = response.getBody(); var httpStatus = response.getStatusCode(); gs.log(responseBody);