Skip to content

Instantly share code, notes, and snippets.

@cmcdevitt
Created May 17, 2022 12:54
Show Gist options
  • Select an option

  • Save cmcdevitt/af255fd4bca690919c03f7d4504eebd2 to your computer and use it in GitHub Desktop.

Select an option

Save cmcdevitt/af255fd4bca690919c03f7d4504eebd2 to your computer and use it in GitHub Desktop.
Test for Inbound oAuth connection Servicenow
/*
Make this part of a Scripted REST API for ServiceNow
As of 2022 SN does not enforce an oAuth connection so you need to check for it.
*/
validateOAuth: function(request) {
try {
var authReturn = '';
var authHeader = request.headers.authorization;
if (authHeader.indexOf("Basic") > -1) {
authReturn = '401-001';
}
return authReturn;
} catch (error) {
return error;
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment