POSTMAN, OAuth2 and Google Directory API

12,889

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.

Share:
12,889

Related videos on Youtube

Sam Scholefield
Author by

Sam Scholefield

Was, education management systems specialist, primarily focused on using G Suite Edu and making life better for teachers, students; and administrators. Now, building the frontend of enterprise applications using a varied toolset. Englishman, father, husband and dog owner. Drinker of both tea and coffee. Player of games and reader of books. Writer of code and rider of mountains.

Updated on September 16, 2022

Comments

  • Sam Scholefield
    Sam Scholefield over 1 year

    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.