I always use Google’s python libraries whenever I can, because I like easy. But the libraries aren’t designed to connect to every endpoint. Anything using the older “m8/feeds” you will have to connect the old-fashioned way: by building out a full OAuth client. And the first place to start any OAuth app development is Postman – a free, must-have tool if you work with APIs.
In postman, when you create a new Workspace and new Collection, the first task is to establish Authorization:
Type : OAuth 2.0
Add auth data to : Request Headers
Find the section called Configure New Token:
Name the token anything
Select “Authorization Code” for the Grant Type
Copy the callback URL to your clipboard
*The callback URL is where you want google to return to after it has finished authorizing you. You’ll need to create a set of OAuth credentials for your service account that has this exact callback URL and if doesn’t match the authentication will fail. That means that every new application you create will need a new set of credentials
Log into console.cloud.google.com and go to Credentials
Click on create credentials and choose Oauth client ID
For the application type, choose Web application.
You can set these credentials to anything you want, just make sure to click the plus sign next to Authorizied redirect URIs and add the Callback URL you copied from Postman
New credentials will be created and you’ll be prompted to download a .json file. You’ll need the information in this file, so take note of where you saved it. I think it’s easiest to open in Notepad ++ or similar text editor and format it so that it’s easy to read.
From here it should be pretty easy to see where all the data goes in the Postman authorization form. The only information not in the file is the Scope and the State. The documentation for the API you’re using will tell you which scopes you need to request.
For the state, just put in any number. I used 1.
Hit Get New Access Token and you should be presented with a Google login popup. After authenticating, Google should grant you the token and return you to Postman with the Token to be used in all your requests.