BryceG
ServiceNow Employee
ServiceNow Employee

We are pleased to announce that starting in version 2.1 of the ServiceNow SDK, introduces support for authenticating to your ServiceNow instance with OAuth 2.0.  This will allow developers to use the SDK and authenticate with their instance using the configured SSO to support external identity providers.

 

Enabling this support will require some configuration changes in your development instance to enable OAuth support for the SDK.  There are two options for installing the configuration:

Option 1: Install the ServiceNow IDE 1.1 or later (coming soon)
Option 2: If you are unable to install the IDE on your ServiceNow environment, then you can use the attached XML files to install the configuration.  To do so, follow these steps:

  •  Download attached zip file and extract it
  • Elevate to security_admin
  • Navigate to any list on your instance (list type does not matter) or navigate to "upload.do"
  • Right click on the column title and select "Import XML"
  • Select "Chose File" and select an xml file from the then "Upload"
  • Repeat last step for every file in the zip file

After installing the configuration files on the instance, you can use the now-sdk to authenticate using OAuth. 

 

From the command line run the command, and specify the alias to name the credential:

now-sdk auth save [alias] --type oauth

 

Input the instance URL and then you should be navigated through the authentication flow for your desired account via web browser.  After completing the authentication flow with your identity provider, you will be returned the the instance with an input box displaying a token.

BryceG_0-1729019085425.png

Copy that token and input it back into the command line prompt, and you will complete the OAuth authentication flow.  That credential is now ready to be used with the sdk for development!

You can find more help and instructions here https://docs.servicenow.com/bundle/xanadu-application-development/page/build/servicenow-sdk/concept/...

Comments
Shiva Prasad
Tera Contributor

How can you authenticate from behind a proxy ? Any proxy settings file with in SDK or does it take from visual studio code the settings?

Version history
Last update:
‎10-17-2024 05:11 PM
Updated by: