
It means you cannot put a password or API key inside your code and access the drive files. The way the latest version (V3) of drive API works is only through OAuth. I: Register a google app by visiting the Google API console: The so called quickstart for drive api and the web based example here show some example code, but what a lot of beginner programmers need is a step-by-step tutorial of how to go about doing it. However, a good documentation to implement this in a backend app, especially a php app is very much lacking. This method of authentication is called OAuth and is very much needed for implementing the drive api. One of the basic tasks here is to authenticate to google and access the drive on the user’s behalf once they grant permission to your app. Exchange authorization code for an access token.This is the second article in the drive series for web programmers that aims to explain how to use the Google Drive API in your web applications to access files/folders on behalf of your logged-in users. Printf("Open the following link in your browser:\n%s\n", $authUrl) $client->fetchAccessTokenWithRefreshToken($client->getRefreshToken()) Refresh the token if possible, else fetch a new one. If there is no previous token or it's expired. $accessToken = json_decode(file_get_contents($tokenPath), true) created automatically when the authorization flow completes for the first The file token.json stores the user's access and refresh tokens, and is Load previously authorized token from a file, if it exists. $client->setPrompt('select_account consent') $client->setAuthConfig('credentials.json') $client->setScopes(Google_Service_Drive::DRIVE) I was able to reproduce via google example setApplicationName('Google Drive API PHP Quickstart') $result = $service->files->create($folder) $folder = new Google_Service_Drive_DriveFile() $service = new Google_Service_Drive($client) $client->setAccessToken('ya29.a0AfH6SMDO-L_7Lp6YWbGtSqWdPHJKCNezQr8-RRgS8xslHInLApC9uxBJVVljPTKEBgR-iidqIorjNaBThU4-aPjuAth1aD7mzjJXn5n2xP1xPw40p_OLssC7Ttj8CpBJHuqsUm89CYWAGL8cCHGhQ2hBY0YjKQ') $client->addScope(Google_Service_Drive::DRIVE) $client->setAuthConfig('code_secret_client.json') My function : public function createFolder($name) I do not really understand where this can come from knowing that I have set the scope indicated in the documentation: $client->addScope(Google_Service_Drive::DRIVE)

"message": "Insufficient Permission: Request had insufficient authentication scopes."

Recently I have set up an automatic file creation system on the google drive, I have integrated the API into my symfony application, I manage to authenticate myself, etc., but I do not block on the step of creation of the file.
