Problems with OAuth authorization code grant flow

raulshred
Kilo Explorer

Hi,

I create an OAuth application.

I follow the steps in

"OAuth authorization code grant flow" page

The first step works fine and the API shows the authentication form, and after fil it, it returns the "code" propertly, but when I use the code in the next URL:

https://myinstance.servicenow.com/oauth_auth.do?grant_type=code&code={the auth code}&redirect_uri={the_same_redirect_url}&client_id={the_same_client_identifier}

Filling the correct paramenters, the API always returns this message:

OAuthProblemException{error='invalid_request', description='Missing response_type parameter value', uri='null', state='null', scope='null', redirectUri='https://www.asg.com', responseStatus=0, parameters={}}

Any idea?

3 REPLIES 3

Sashi K1
Kilo Guru

Just follow below link, solves all your problems. I could easily set without any hassles.



How to setup OAuth2 authentication for RESTMessageV2 integrations



Good luck!


Hi Sashikanth,



It seems that this information is not exactly that I need.



This docs shows how to use a library with grant_type=password. My intention is to not send the credentials, just a token.



The flow that I want to achieve is:



-Click a button from my web page.


-This button open a popup that shows a service now form to fill the credentials.


-This page does a redirection with a access code.



This steps was correct but, when I do the call in order to get the token, this error always appears:



OAuthProblemException{error='invalid_request', description='Missing response_type parameter value', uri='null', state='null', scope='null', redirectUri='https://www.asg.com', responseStatus=0, parameters={}}



My intention is to delegate the fill credentials process in the service now credentials form



Best Regards,



Raúl.


More information:



In the "Manage Tokens"   section I have several tokens like "access_token".



If I try this URL for example:



https://dev32576.service-now.com/api/now/table/incident?access_token=IlCuGaOt2Zaxv75JcIFoq2GYiaHpwbk...



The access code is in theory correct. I Copy pasted from Manage Tokens section.



The browser always shows the credentials form.



How can I obtain a correct access code in order to request with an access code?



Best Regards,



Raúl.