Configure OAuth in ServiceNow

David Santel
Giga Guru

Can anyone help solve the below OAuth setup question?

 

In order to use OAuth(Azure) I need to know these 2 fields (OAuth should be configured by ServiceNow’s instance admin (you), https://docs.servicenow.com/bundle/madrid-platform-administration/page/administer/security/task/t_Se... 😞

 

- client_id

- client_secret

 

In summary, I need to solve this authentication problem: create (or just grant access) to local user or configure OAuth in ServiceNow and give me values for those 2 fields

9 REPLIES 9

Ankur Bawiskar
Tera Patron
Tera Patron

Hi David,

So it seems you need to enable OAuth and give 3rd party an endpoint for getting access token so here are the steps for setup and test it

1) check OAuth 2.0 plugin is active or not; it should be automatically be active

-> By default, the OAuth plugin is active on new and upgraded instances. If the plugin is not active on your instance, you can activate it. Name of plugin is “OAuth 2.0”. In the left navigation go to the Plugins module under System Definition; Search with name as OAuth 2.0

2) following system property “com.snc.platform.security.oauth.is.active” must be active for the instance for generating access token

3) Navigate to System OAuth > Application Registry and then click New.

On the interceptor page, click Create an OAuth API endpoint for external clients and then fill in the form.

Name - Unique Name that identifies the application

Client ID - auto-generated by the instance

Client Secret - auto-generated by the instance

Create a user in User (sys_user) table which will be used for getting the Access Token in OAuth. There is no need to give any role to this user.

How to test it:

Open Postman application -> it is a open source 3rd party tool for testing APIs

Set the HTTP Method as POST

Endpoint URL -> https://instanceName.service-now.com/oauth_token.do. This is the default endpoint for getting access tokens.

Requests should be formatted as URL-encoded; Requests Parameters should be sent in HTTP POST body

Access requests made within the access token's expiration time always return the current access token.

Different request parameters to be sent in the format of Key Values; After filling all the values hit the SEND button

grant_type - password

client_id - from previous step

client_secret - from previous step

username - username created above

Password - password created for user above

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Getting a 401 Unauthorized...How to fix?find_real_file.png

@Ankur Bawiskar Thanks a lot for this detailed explanation. However, we have ran into situation while testing on Postman - Only Admin accounts are able to generate accesstoken.

Non-Admin users get access_denied error within postman call. (We are testing by granting itil, API , REST related roles) - not been successful.

What would you suggest to troubleshoot further. If ACL ? Which tables would it be ?

Madhusudan

 

 

find_real_file.png 

 it says system properties->all properties

find_real_file.png

on the left pane i dont see anything like all properties nor the option to add in form