Uploading files to Google Drive using cURL – access_token expiry issue

My goal is to have a script with cURL requests that can be ran at anytime to upload a specified file to our Google Drive account without any manual input.

I'm able to upload a file to Google Drive using cURL when I use a freshly created "access_token".

However when I run the same cURL command to upload another file at a later time, I get an invalid credentials error.

And from reading, it's due to the "access_token" becoming expired. And in order to generate a new "access_token", I need to generate a new "user_code" and verify this code at "https://www.google.com/device".

Since I require a script to be ran without any manual input, I don't want to have to generate a "user_code" everytime I need to upload a file since this is a manual step.

Should I be using the generated 'refresh_token' in the cURL request in order to upload a file at any given time?

Any help would be greatly appreciated.



Read more here: https://stackoverflow.com/questions/64886110/uploading-files-to-google-drive-using-curl-access-token-expiry-issue

Content Attribution

This content was originally published by enormace at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: