Google Drive API Upload: Error 401 on Kodular but Works on Postman

I want to upload a text file to Google Drive using the Google Drive API.
I tested it with Postman, and it worked using the following code:

curl --location 'https://www.googleapis.com/upload/drive/v3/files?uploadType=media' \
--header 'Authorization: Bearer [access_token]' \
--header 'Content-Type: text/plain' \
--data 'Hello from Postman'

However, when I tried the same method on Kodular, I got the following error:
401 Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential.

Did I do something wrong, or is this not possible on Kodular? Do I need to use Google Apps Script instead?

The request header is a list of key value pairs
i.e. the value is Bearer ya29…

Aldo it might be necessary to add a second key value pair, see again your curl example

Content-Type
text/plain

Taifun

1 Like

Sorry, I didn’t notice earlier. The saved image is incomplete. This is how it should be. Please check again. Thank you!

Hi try this one. It may work. Ensure spelling.

1 Like

Thank you very much, it works.