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

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Maran,

If you are using Inbound Scripted REST API with OAuth then the 3rd party should be able to generate the access token and refresh token.

In this case only ServiceNow can generate the tokens as it is Authorization Server if external application wants to access ServiceNow resource.

I doubt your scenario can be achieved since the token was generated by other system which ServiceNow may not recognize.

Regards
Ankur

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

Community Alums
Not applicable

Hi @Ankur Bawiskar ,

Thanks for the quick response. 

Yes, I also was in that understanding but I wanted to explore the solution in another perspective similar to how we can access Microsoft graph API with a token generated from Microsoft Azure as the authorization server. so by that, we can see how azure and graph communicates the Oauth token in the back end.

Any help in the above angle to fit service now is much appreciated!! 

if not we doubt that it is not possible for service now to have a separate authorization server and should be within service now.

 

Hi Maran,

From my experience since the resource or the endpoint you wish to access is being provided by ServiceNow it expects ServiceNow to be the authorization server.

So I doubt ServiceNow currently supports this. If you wish to confirm this you can raise HI ticket with ServiceNow whether it is possibly technically

Regards
Ankur

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

@Maran

Let me know if I have answered your question.

If yes please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Anukr

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