OAuth authorization code grant flow : Access Denied Error

kahuna_windows
Tera Contributor

Getting access denied while getting access token and refresh token from the authorization code. Please check the attached screenshot, need help if I need to enable any permissions.

No issue in getting the authorization code, the only problem is while getting the access token and refresh token using the authorization code.

 

11 REPLIES 11

palanikumar
Mega Sage

Hi,

To generate access token and refresh token you have to use oauth_auth.do. oauth_token.do is to generate access token using refresh token.

I suggest you to use authorization tab under the url to generate token. Fill the details under Authorization as mentioned below and click "Get New Access Token" button. You'll be prompted for User Id and password. After passing it, Post man will display Refresh token and Access token in the screen. Refresh token can be used for future access token generation.

Type - OAuth2.0

Right side you will see Configure New Token. It will list options for token generation under this

Token Name - Any name

Grant Type - Authorization Code

Call back URL - https://www.getpostman.com/oauth2/callback

Auth URL - https://<your instance>.service-now.com/oauth_auth.do

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

Client ID - Your client id

Client Secret - Your client secret

Scope - useraccount

State - state

Client Authentication - Send as Basic Auth Header

 

Thank you,
Palani

Thanks @palanikumar for the answer, this is working. I'll just try this once through the code as well and let you know if I need any other help, thank again.

Hi,

 

Thanks for the steps. I did follow them but i am getting "Missing redirect URL in application registration." when i try to get new access token.

 

Pls guide

If you are testing via Postman then you can use https://www.getpostman.com/oauth2/callback as redirect url.

Thank you,

Palani

Thank you,
Palani