Created
May 17, 2022 12:54
-
-
Save cmcdevitt/af255fd4bca690919c03f7d4504eebd2 to your computer and use it in GitHub Desktop.
Test for Inbound oAuth connection Servicenow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 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