2
votes

I'm running into issues when attempting to obtain an OAuth2 authorization token in Postman for the Google Directory Api (this is for an EDU domain)

I have created an Application in the Google developer console and ensured that the API is enabled (Admin SDK), I then created a set of 'Web application' credentials and used 'https://www.getpostman.com/oauth2/callback' as the 'Authorized redirect URI' as below (ID and secret removed):

Google Developer console - web app credentials

In Postman I have set the 'Authorization URL' and 'Access token URL' to 'https://accounts.google.com/o/oauth2/auth' and included 'Client ID' and 'Client secret' as obtained from the Developer console. I also included the scope 'https://www.googleapis.com/auth/admin.directory.user' as below (ID and secret removed):

POSTMAN OAuth2 token request

When clicking 'Get Access Token' I am presented with an authorization dialog:

Auth dialog

When I click 'Allow' POSTMAN presents:

POSTMAN error

POSTMAN also provides a debug URL which when clicked passes me through another authorization dialog (as above) before the browser presents the following error:

Duplicate headers

Can anyone help with this, I'd really appreciate any pointers!? I'm thinking that its actually an error in the returned header, which means that the OAuth2 part may well be functioning correctly. As POSTMAN is installed as a Chrome extension I have no option to test in another browser.

1

1 Answers

4
votes

You've mentioned that you've set the Authorization and Access Token URL to the same value. This is probably incorrect. The Authorization URL is the one that the user is shown (which is working). The Access Token URL is the one to which a back-end POST call is made.

Try setting the Access Token URL to https://accounts.google.com/o/oauth2/token. If that doesn't help, you'll need to contact Google.