ServiceNow inbound API authorization with token from different tool

Community Alums
Not applicable

Hi All, 

We are working on a project to implement inbound scripted REST API in service now based on OAuth authentication.OOB service now works as both authorization server to give token and as well as resource server to consume the token for authentication and share the response for an API call.

The difference in our implementation is our client has another tool that can work as an authorization server to generate token as it is the central gateway to authentication and with that token if external application call service now API it should be allowed by OAUTH to provide response.

find_real_file.png

Kindly let us know any possibility or solution to achieve the requirement.

Thanks in advance.

 

1 ACCEPTED SOLUTION

hammad ul aziz2
Mega Guru

I think OIDC would help you in this scenario

below is the example of OIDC with OKTA

https://hi.service-now.com/kb_view.do?sysparm_article=KB0778342 

 

how does it work with ServiceNow

Open ID Connect with OKTA



ServiceNow supports External OIDC Provider and required the following parameters 

  • Client ID 
  • Client Secret 
  • Meta URL

As shown below

find_real_file.png



We can also set up the user provision so that if the user doesn’t exist in serviceNow and trying to access the ServiceNow APIs with valid external OKTA token we can created the user at runtime and grant the access for APIs accordingly.
As shown below.

find_real_file.png


Once these configurations are done on ServiceNow side now we can use the external token to access ServiceNow APIs.
So let’s try to get the token from by performing login to OKTA using PostMan as shown below. And his the request token button as shown below

find_real_file.png


Let’s fill up the user credentials and Sign In


find_real_file.png


Now as you can see we got the tokens as shown below


find_real_file.png



Now we can use the Id_token as Authorization to access the ServiceNow APIs and ServiceNow will validate this token with okta and then grant the access accordingly.
As shown below we have successfully received the data using that token from ServiceNow.

find_real_file.png

 

please mark this helpful and correct if this helped you in any way.

 

thanks

Hammad

View solution in original post

7 REPLIES 7

hammad ul aziz2
Mega Guru

I think OIDC would help you in this scenario

below is the example of OIDC with OKTA

https://hi.service-now.com/kb_view.do?sysparm_article=KB0778342 

 

how does it work with ServiceNow

Open ID Connect with OKTA



ServiceNow supports External OIDC Provider and required the following parameters 

  • Client ID 
  • Client Secret 
  • Meta URL

As shown below

find_real_file.png



We can also set up the user provision so that if the user doesn’t exist in serviceNow and trying to access the ServiceNow APIs with valid external OKTA token we can created the user at runtime and grant the access for APIs accordingly.
As shown below.

find_real_file.png


Once these configurations are done on ServiceNow side now we can use the external token to access ServiceNow APIs.
So let’s try to get the token from by performing login to OKTA using PostMan as shown below. And his the request token button as shown below

find_real_file.png


Let’s fill up the user credentials and Sign In


find_real_file.png


Now as you can see we got the tokens as shown below


find_real_file.png



Now we can use the Id_token as Authorization to access the ServiceNow APIs and ServiceNow will validate this token with okta and then grant the access accordingly.
As shown below we have successfully received the data using that token from ServiceNow.

find_real_file.png

 

please mark this helpful and correct if this helped you in any way.

 

thanks

Hammad

@Maran please mark this helpful or correct if this helped you, 

thanks

Hammad

Hi @hammad ul aziz2 

 

I tried and it worked, but the problem here is, you have to use same client ID (which is registered in OKTA) in Postman and in SN when getting the token. However, I don't think in real world we could use same client ID in External System [Postman in this case, right hand side block in the diagram] and in ServiceNow.

 

Let me know your views.

 

Thank you!

Sudipta