Explore more
Connections
Call Google APIs with OAuth 2.0 HTTP request
11 min
in make, you can call google apis with the https //apps make com/http#pkx7q module since google apis use the oauth 2 0 protocol for authentication and authorization , you will need to select the oauth 2 0 authentication type when configuring your connection for details on required apis, scopes, and connection settings, refer to the api documentation of the specific google service you are using you can find it in the https //developers google com/apis explorer/ to call google apis with the http > make a request module, you need to /#create and configure a google cloud platform project /#establish the oauth connection inmake /#configure the http module to send the request create and configure a google cloud platform project to connect {{product name}} to google services using your custom client credentials, you need to create and configure a project in the google cloud platform create a google cloud platform project log in to the https //console cloud google com/ using your google credentials on the welcome page, click create or select a project in the next window, click new project in the upper right corner change the default project name and project id , if needed select the location for your project, and click create on the top panel, next to the google cloud logo, click select a project in the next window, click the project you just created you'll now see the google cloud platform project you've created o n the top panel, next to the google cloud logo to create a new project or work in the existing one, you need to have the serviceusage services enable permission if you don’t have this permission, ask the google cloud platform project owner or project iam admin to grant it to you enable apis in the left sidebar of the google cloud platform, click apis & services > library search for the api you need for your project (e g , google drive, google sheets, etc ) click the relevant api for example, google sheets api c lick enable your api is now enabled configure your oauth consent screen in the left sidebar of the google cloud platform, click apis & services > oauth consent screen click get started in the overview section u nder app information , enter make as the app name, enter your gmail address, and click next under audience , select external , and click next for more information regarding user types, refer to https //support google com/cloud/answer/9110914#exceptions ver reqts under contact information , enter your gmail address, and click next under finish , agree to the https //developers google com/terms/api services user data policy?authuser=1 , and click continue , then create in the next window, click create oauth client you'll be redirected to the clients tab you can skip it for now or refer to the docid\ w5upqrhugxzcketifp7la section to configure it i n the branding section u nder authorized domains, click +add domain a dd make com and integromat com click save in the audience section click publish app to update the project status to in production if you want the project to remain in the testing publishing status, click +add users and enter your gmail address under test users publishing status testing if you keep your project in the testing status, you will be required to reauthorize your connection in make every week to avoid weekly reauthorization, update the project status to in production in production if you update your project to the in production status, you will not be required to reauthorize the connection weekly to do that, go to the google auth platform , the audience section, and click publish app if you see the notice needs verification , you can choose whether to go through the https //support google com/cloud/answer/13463073?authuser=1\&visit id=638718595933013017 1855034908\&rd=1 for the app or to connect to your unverified app currently, connecting to unverified apps works in make, but we cannot guarantee that google will allow connections to unverified apps for an indefinite period for more information regarding the publishing status, refer to the publishing status section of https //support google com/cloud/answer/10311615#zippy= your oauth consent is now configured create your client credentials in the left sidebar of the google cloud platform, click apis & services > oauth consent screen go to the clients section, and click +create client under create oauth client id in the application type dropdown, select web application in the name field, update the name of your oauth client this will help you identify it in the console afterward under the authorized redirect uris, click + add uri enter https //www integromat com/oauth/cb/oauth2 and click save this redirect uri is required to use the http > make a request module in make click create you'll see a message that the oauth client has been created c opy your client id and client secret values, and store them in a safe place you will use these values in the client id and client secret fields in make establish the oauth connection in make to establish the connection in make log in to your {{product name}} account create a new scenario or open an existing one and add an http > make a request module to your {{scenario singular lowercase}} in the authentication type field, select oauth 2 0 in the credentials field, click create a connection (or add next to create a connection ) to create your oauth 2 0 connection in the connection n ame field, enter a name to distinguish your connection in the flow type field, select authorization code as you'll need to enter further both an authorize uri and token uri in the authorize uri field, enter the authorize uri as it's defined in the google api documentation https //accounts google com/o/oauth2/v2/auth in the token uri field, enter the token uri as it's defined in the google api documentation https //oauth2 googleapis com/token in the scope field, click +add item to add the scopes required for your http request you can check the scopes in the google service's api documentation for the https //developers google com/workspace/sheets/api/scopes , for example, you can use https //www googleapis com/auth/drive https //www googleapis com/auth/spreadsheets in the client id field, add the client id you obtained from your google cloud platform project app in the client secret field, add the client secret you obtained from your google cloud platform project app enable the advanced settings toggle, and select space in the scope separator field choosing the right scope separator is important, as the wrong one can prevent you from establishing the connection to avoid having to constantly refresh the connection, in the authorize parameters , click +add item and add key access type value offline click save complete the required steps to s ign in to google if you see a message that google hasn't verified your app, you'll need to confirm that you trust the developer c lick advanced click go to integromat com (unsafe) then, if prompted, authenticate your account, grant all requested permissions, and confirm access you've successfully created the oauth 2 0 connection and can now make the http request to a google app you can https //help make com/connect an application#tn2pj at any time to do that open connections from the left sidebar find the required connection, click the three dots next to its name, and click edit you will be able to add or remove scopes and edit some other connection parameters configure the http module to send the request to make an http post request to the google sheets api to create a spreadsheet in the url field, enter the url according to the desired output to create a spreadsheet, for example, you would use https //sheets googleapis com/v4/spreadsheets select the post method required for this api call leave the headers and query sections empty for the body section in the body content type field, select application/json in the body input method field, select data structure in the body structure field, click add to create a new data structure enter a name for your data structure to distinguish it afterward click +add item to set up the parameters as 'key value' pairs alternatively, click generate to enter a json text that will be converted into 'key value' pairs for example { "properties" { "title" "new spreadsheet created by make" }, "sheets" \[ { "properties" { "title" "initial data" } } ] } click generate this way, you'll add a title field to add the name of the spreadsheet you create, and a title field for the sheet created in that spreadsheet click save in the body content field, you can now enter the names of the spreadsheet and sheet that you'll create click save and run the module you can now check your google sheets a new spreadsheet called new spreadsheet make with a new sheet will be created you can also see it in the output troubleshooting if you get an error while establishing the oauth 2 0 connection to any google service in the http > make a request module, ensure that you've completed all the steps described above below is the summary of the key items you need to verify check your google cloud platform project required api is enabled ensure you've enabled the required google api, as explained /#enable apis authorized domains are added add integromat com and make com as authorized domains in the branding section, as explained in step 4 /#configure your oauth consent screen test user is added, or the app is published add your gmail account as a test user or publish the app, as explained in step 5 /#configure your oauth consent screen authorized redirect uri is added add the correct https //www integromat com/oauth/cb/oauth2 in the clients section, as explained in step 4 /#create your client credentials check the connection settings of the http > make a request module in make authorize uri and token uri are correct use https //accounts google com/o/oauth2/v2/auth as authorize uri and https //oauth2 googleapis com/token as token uri, as explained in step 4 /#establish the oauth connection inmake required scopes are added add all the scopes needed for your http request, as explained in step 4 /#establish the oauth connection inmake correct client id and client secret are used enter the credentials you obtained from your google cloud platform project, and ensure they match scope separator is set to space set the scope separator to space if you're adding more than one scope, as explained in step 4 /#establish the oauth connection inmake