Oauth2 authorization url generated by ServiceNow appending extra "&" to response_type

manasi7
Kilo Contributor

We are using OAUTH2 for REST messaging and "authorization code" as a grant type.

Our authorization URL is : https://our_authorization_server/oauth2/authorize

The URL generated by ServiceNow to get the OAuth token is as follows :

https://our_authorization_server/oauth2/authorize

?&response_type=code

&redirect_uri=https://dev1234.service-now.com/oauth_redirect.do&client_id=1234585885869459430303003

The issues we are facing is :

1] &response_type=code

The parameter response_type has "&" prepended to it , which causes our authorization API to fail.

2] value of parameter "state" is not being set in the URL.

How can we set value for parameter "state" in ServiceNow.

Thanks! In advance

Message was edited by: Manasi Amale

8 REPLIES 8

Pranav Bhagat
Kilo Sage

I have worked on oauth so can u please elaborate


Are u using any active directory


Hi Pranav,


Thanks for the reply.



We are not using active directory.


We are using our own Identity Management Service to authorize the ServiceNow request.


Here are the steps we follow :



1] Create oauth profile in oauth -> application registry , we mention authorize API here (please find the screenshot)


2] Use the profile for REST messaging in outbound -> REST messages


3] Now when we hit "Get OAuth Token", service-now redirects with following URL



https://our_authorization_server/oauth2/authorize


?&response_type=code&redirect_uri=https://dev1234.service-now.com/oauth_redirect.do&client_id=1234585885869459430303003



Please note : service-now has appended & before "response_type" parameter which is causing our parsing to fail.


Any idea what is the reason for this ?



Also how can we send parameter "state" in service-now.


Please let me know if further clarifications are required



app_registry.png


So you are using some 3rd part like google for username and password?