Rookie question: http module oauth not getting access to google sheets document

Hi Make community.

I am currently working on a scenario that creates an invoice in google sheets, downloads the document and sends an email to a customer.

However i cannot seem to make the download part work, because i get an html file instead that returns google’s login-page.

I am using the http: Make an OAuth 2.0 Request to download the google sheets file.

I have checked multiple times that my Client ID and Client Secret is correct in my connection, so the problem is not there.

In my connection i have the following scopes:

https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/drive.readonly
https://www.googleapis.com/auth/spreadsheets.readonly

And the rest of the properties is as follows:

This is how my module is set up

When i replace my spreadsheet ID with the ID of a spreadsheet with a public shared link adress the scenario runs flawless. So it is the verification process that has a problem.

I have enabled the google sheets and google drive API’s.

Here is the information from https://console.cloud.google.com/auth/

Hope you guys can help me :slight_smile:

Regards Silas

Hello,

  1. Are you using personal @gmail account or Workspace account?
  2. There is native module to download files-

it will even handle conversion to PDF for you if needed.

When using a Workspace account, you can use the native Make.com app to handle your OAuth so you won’t have to bother with Google Console :slight_smile:

Hi, thanks for your quick response.
The reason i am using an http module is that some parameters of the download is customizable as opposed to the google drive download a file module. For example i use this url in the http module:

This tells the url to don’t include gridlines and set the size to an a4 sheet

I have not found this option in the Google Drive module

And to answer your question, i am using a personal @gmail account :slight_smile:

Use Make an API Call module instead :slight_smile: It will connect via Make<–>Google OAuth so no need to create an additional app in Google Console.

1 Like

Hi again, I just tried what you suggested, but unfortunately it doesn’t work.

I asked chatGPT what the problem was by giving it the input value and output value (can be found down underneath). It said

When you use “Google Sheets → Make an API call” in Make.com, you can’t use the full https://docs.google.com/... URL like in your example.
The Google Sheets API only allows requests to endpoints under https://sheets.googleapis.com/v4/spreadsheets/``..., not document view links such as docs.google.com/spreadsheets/``....

That’s why you’re seeing the error — the Google API tries to add /v4/ in front of your URL, resulting in a request to:

https://sheets.googleapis.com/v4/https:/docs.google.c

I hope you can assist me in what to do now, because i really am lost :grimacing:

Input value

[
    {
        "url": "https://docs.google.com/spreadsheets/d/1clcDTwxYmw2zkO2uN_dkipuxoPNeiyleWXZbPTdNmLI/export?format=pdf&gid=0&gridlines=false&size=A4&portrait=true&fitw=true",
        "method": "GET",
        "headers": [
            {
                "key": "Content-Type",
                "value": "application/json"
            }
        ]
    }
]

and the output value.

<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 404 (Not Found)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>404.</b> <ins>That’s an error.</ins>
<p>The requested URL <code>/v4/https:/docs.google.com/spreadsheets/d/1clcDTwxYmw2zkO2uN_dkipuxoPNeiyleWXZbPTdNmLI/export?format=pdf&amp;gid=0&amp;gridlines=false&amp;size=A4&amp;portrait=true&amp;fitw=true</code> was not found on this server. <ins>That’s all we know.</ins>
: <!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 404 (Not Found)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>404.</b> <ins>That’s an error.</ins>
<p>The requested URL <code>/v4/https:/docs.google.com/spreadsheets/d/1clcDTwxYmw2zkO2uN_dkipuxoPNeiyleWXZbPTdNmLI/export?format=pdf&amp;gid=0&amp;gridlines=false&amp;size=A4&amp;portrait=true&amp;fitw=true</code> was not found on this server. <ins>That’s all we know.</ins>
- <!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 404 (Not Found)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>404.</b> <ins>That’s an error.</ins>
<p>The requested URL <code>/v4/https:/docs.google.com/spreadsheets/d/1clcDTwxYmw2zkO2uN_dkipuxoPNeiyleWXZbPTdNmLI/export?format=pdf&amp;gid=0&amp;gridlines=false&amp;size=A4&amp;portrait=true&amp;fitw=true</code> was not found on this server. <ins>That’s all we know.</ins>

Hi,

Oh my goodness. Excuse me!

I was under the impression from your post that you were willing to use an API and missed the URL you’re pointing to in your request visible in screenshoots.
You’re simply generating an export link. You don’t need any cloud platform app or even modules to do this.

All you need to do is change the permissions to public before generating the link and fix one issue in your URL.

https://docs.google.com/spreadsheets/d/{{1.spreadsheetId}}/export?format=pdf&gridlines=false&size=7&portrait=true&fitw=true

PDF:

format=pdf

Grid (bool)

gridlines=false

Size- you can not use A4 etc. there are codes A4=7; A3=6; A5=8; Letter=0

size=7

Portrait:

portrait=true

fit:

fitw=true

HTTP Get a file

Module config with working URL
{
    "subflows": [
        {
            "flow": [
                {
                    "id": 4,
                    "module": "http:ActionGetFile",
                    "version": 3,
                    "parameters": {
                        "handleErrors": false
                    },
                    "mapper": {
                        "url": "https://docs.google.com/spreadsheets/d/{{1.spreadsheetId}}/export?format=pdf&gridlines=false&size=7&portrait=true&fitw=true",
                        "serializeUrl": false,
                        "method": "get",
                        "shareCookies": false
                    },
                    "metadata": {
                        "designer": {
                            "x": 900,
                            "y": 0
                        },
                        "restore": {},
                        "parameters": [
                            {
                                "name": "handleErrors",
                                "type": "boolean",
                                "label": "Evaluate all states as errors (except for 2xx and 3xx )",
                                "required": true
                            }
                        ],
                        "expect": [
                            {
                                "name": "url",
                                "type": "url",
                                "label": "URL",
                                "required": true
                            },
                            {
                                "name": "serializeUrl",
                                "type": "boolean",
                                "label": "Serialize URL",
                                "required": true
                            },
                            {
                                "name": "method",
                                "type": "hidden",
                                "label": "Method"
                            },
                            {
                                "name": "shareCookies",
                                "type": "boolean",
                                "label": "Share cookies with other HTTP modules",
                                "required": true
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "metadata": {
        "version": 1
    }
}

Sample scenario:

Excuse me once again!

Hey Silas,

Make’s documentation is unfortunately really poor when it comes to Google OAuth so it’s often trial and error with the redirect URIs, scopes and authorization parameters until it works.

Try stripping everything down to basics and make the following changes to your setup.

First, in your Google Cloud Console project:

1. APIs & Services > Enable APIs & Services

Search for Google Drive API and make sure it’s enabled.

2. Branding

Authorized domains: make sure these are set:

  • integromat.com
  • make.com

3. Audience

Test Users: make sure your Gmail account is added as a test user.

4. OAuth Consent Screen > Clients

Authorized Redirect URIs - remove all except these two:

  • https://www.make.com/oauth/cb/oauth2
  • https://www.integromat.com/oauth/cb/oauth2

5. Data Access (scopes)

To download a Google Sheet, you should only need this scope:
https://www.googleapis.com/auth/drive.readonly

6. In Make > HTTP OAuth 2.0 Connection

Create a new connection and configure it like this:

  • Authorize URI: https://accounts.google.com/o/oauth2/v2/auth
  • Token URI: https://oauth2.googleapis.com/token
  • Scope: https://www.googleapis.com/auth/drive.readonly
  • Client ID & Secret: [from your web client]

7. Expand advanced settings:

  • Scope separator: SPACE
    (it doesn’t matter for your use case here since you only use one scope, but just as a note in the future if you’ll need to add more scopes)
  • Authorize parameters (this should remove the requirement to constantly refresh your connection):
    • key: access_type
    • value: offline

Don’t add any other parameters in this advanced section, leave all blank.


The connection should go through with no issues - if you run into any kind of errors during the login to your Google account, report back with what the error was.

Once the connection is established, paste your docs.google.com link like you had, use the GET parameter, and make sure you have viewer or editor access to the sheet with the account you configured as test user in Google Cloud Console.

If it works, the response from the module should have status code 200 and the data should be a binary buffer.

Cheers!

1 Like

No problem, and thank you for your time - i found the mistake :slight_smile:

Thank you for taking your time to help me - the problem was with the scopes, so thank you so much. You saved me so much time :slight_smile:

1 Like