Cannot configure JWT based authentication for inbound API calls

mallikarjun7991
Tera Contributor

I am trying to integrate a custom internal application which is to get data from Service Now. The data I am trying to get is being fetched by Table APIs. 

Currently I have enabled authentication using grant type as password. I supply a Client ID, user name, passwords for the same to the table API and this works.

But I need to change to JWT based authentication. I referred to the product documentation available at https://docs.servicenow.com/bundle/vancouver-platform-security/page/administer/security/task/create-... .
We completed all actions listed in Step #2 Set up the configuration in your ServiceNow instance to verify the incoming JWT.
In Step #3 Send a cURL request containing the JWT token to obtain an access token from your instance. Here we are asked to pass a string value for assertion. The document does not explain how to generate the assertion token. Please help me know how assertion value can be generated. Any links to the available documentation will also help.

 

Thanks in advance.

3 REPLIES 3

ahefaz1
Mega Sage

@mallikarjun7991 ,

You will need to use an external library to create the assertion.

Refer to something like below:

 

https://pyjwt.readthedocs.io/en/latest/

https://stackoverflow.com/questions/56437612/how-to-generate-jwt-assertion-in-python

 

You can also do it using node.js with the jsonwebtoken package.

 

Please accept solution OR mark helpful.

 

Thanks,

Niamul Arifin
Tera Expert

Take a look at this article. This one has a better explanation.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1275215 

Hi Niamul,

 

In this instance it appears that the JWT assertion is being generated by the provider ServiceNow Instance and then shared with the client. Does that mean that the JWT always has to be generated on instance? Or is there some way to share the secret so the client can generate the assertion themselves?

 

Thanks!