REST API OAuth

burn907
Tera Contributor

I am unable to get a REST API token using ServiceNow OAuth. We are not yet on Zurich to make use of the MIC. I selected OAuth API endpoint for external clients. The token does not get issued when using Client ID and secret. We have Entra ID serving as our OIDC external provider, but only for SSO. There seems to be a redirect here, but this won't support REST API as far as I know. 

 

Any help would be really appreciated.

15 REPLIES 15

burn907
Tera Contributor

Is this the correct token endpoint URL? 

https://<your-instance>.service-now.com/oauth_token.do

Do you want to recieve a token from ServiceNow?  So do you want to give an endpoint to an external system that can authenticate into ServiceNow via this token?

Or would you like to authenticate e.g into Microsoft Entra towards servicenow?

burn907
Tera Contributor

Whilst future best practise suggests we should have all service principals managed in Entra, I don't believe it is necessary here. I just need to receive a token from ServiceNow 

its okay, if you have created an application registry:
servicenow.com/docs/bundle/zurich-platform-security/page/administer/security/task/t_CreateEndpointforExternalClients.html

Then from the external sytem you can use these curl examples. (If you do a client grant credential flow you do not need username and pw)
https://www.servicenow.com/docs/bundle/zurich-platform-security/page/administer/security/reference/r...

Example curl:

$ curl -d"grant_type=password&client_id=be3aeb583ace210011c15b24a43e25d8
&client_secret=client_password
&username=admin&password=admin"
https://instancename.service-now.com/oauth_token.do


Example refresh token:

$ curl -d"grant_type=refresh_token&client_id=be3aeb583ace210011c15b24a43e25d8
&client_secret=client_password
&refresh_token=w599voG89897rGVDmdp12WA681r9E5948c1CJTPi8g4HGc4NWaz62k6k1K0FMxHW40H8yOO3Hoe"
https://instancename.service-now.com/oauth_token.do