I have a web form which allows users to upload files to my server, I added a button for users to select files from their google drive.
After the user selects a file, I get that file id and I have an oauthtoken for that user.
I want to send this file id and oauthtoken back to my server, and make my server download the file.
I installed the google client library on my server, and trying to download the file
this is my code:
$client = new Google_Client();
$client->setAccessToken($token);
$service = new Google_Service_Drive($client);
$file = $service->files->get($file_id);
my token is in the form of 'ya29.FgJJWfsXI8eisDeFaNcIv6RwZH4FEozeEpjOzoVI9GeQVytY6v....' but I get an error "Could not json decode the token" from the second line, what am I doing wrong?
how can I use the oauthtoken from my client side to make an authorized request to download the file?