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" every time 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.