servicenow authorization_code grant flow is not working

Bilal Muzamil
Tera Contributor

Problem:

I am trying to do authorization_code flow in my servicenow instance.

I have the following set up:

 

1. clientId

2. clientSecret

3. redirect_uri

 

After doing log in through UI. I get the code. But when I exchange that code for an access/refresh token. I see:

 

{"error_description":"access_denied","error":"server_error"}

 

Can someone please help me out?

BilalMuzamil_0-1710863150636.png

 

7 REPLIES 7

Tony Chatfield1
Kilo Patron

Hi, oauth token requests are 'POST' but your incomplete screenshot shows a 'GET'. Have you followed these instructions?
Using the Oauth authorization grant flow to get a refresh and access token from a ServiceNow instanc...

I am facing same issue. And it is a post request for me. i think everything is followed as per documentation.

1__BakhtawerS_1-1710880253335.png

The admin roles are exactly setup. 

 

 

Hi Tony, thank you for your prompt response:

 

1. This link provided here 

BilalMuzamil_0-1710882356768.png

 

redirected me to this page: 

BilalMuzamil_1-1710882391043.png

 

Which does not seem correct

 

We tried to follow the next steps in the document

 

2. When we go to the url to get the code:

https://<instanceName>.service-now.com/oauth_auth.do?response_type=code&redirect_uri=https://app.hp-...

 

it returned: 

Missing code_challenge parameter in the request

 

Could you please help us out? Maybe we can jump on a call to unblock this flow as this is a priority for us 🙂 

 

Thank you very much!

Hi Tony, thank you for your response

 

1. the link mentioned here 

BilalMuzamil_1-1710882672960.png

 

redirected me to this page which does not seem correct

BilalMuzamil_2-1710882700672.png

 

Also when I tried the url with this url:

 

https://<INSTANCENAME>.service-now.com/oauth_auth.do?response_type=code&redirect_uri=https://app.hp-...

 

it returned:

BilalMuzamil_3-1710882771709.png

 

Could you please help? Could we jump on a call to resolve this as this is a priority for us?