Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Drive SDK Service Account Error "The authenticated user has not installed the app with client id ..."
    text
    copied!<p>I am trying to create a Google Drive app that can run in the background (e.g. a cronjob), without any user interaction, using Google Drive SDK Service Account, but it gives me this error and I can't understand why:</p> <blockquote> <p>Error calling POST <a href="https://www.googleapis.com/upload/drive/v1/files?uploadType=multipart" rel="nofollow">https://www.googleapis.com/upload/drive/v1/files?uploadType=multipart</a>: (403) The authenticated user has not installed the app with client id {my_client_id}</p> </blockquote> <p>On Google APIs Console, I have activated Drive API and Drive SDK. On the Drive SDK tab, I have setup all the required information. I also have published my app for testers only to the Chrome Web Store, and installed it into my Google Chrome and the application name appears on my Google Drive "Create" menu.</p> <p>This is a snippet of my code:</p> <pre><code>&lt;?php require_once dirname(__FILE__).'/google-api-php-client/src/apiClient.php'; require_once dirname(__FILE__).'/google-api-php-client/src/contrib/apiDriveService.php'; $apiClient = new apiClient(); $apiClient-&gt;setClientId(DRIVE_CLIENT_ID); $apiClient-&gt;setClientSecret(DRIVE_CLIENT_SECRET); $apiClient-&gt;setAssertionCredentials(new apiAssertionCredentials( OAUTH2_EMAIL, array('https://www.googleapis.com/auth/drive.file'), file_get_contents(SERVICE_ACCOUNT_PRIVATEKEY_FILE)) ); $apiDriveService = new apiDriveService($apiClient); $file = new DriveFile(); $file-&gt;setTitle('filename.txt'); $file-&gt;setMimeType('text/plain'); $createdFile = $apiDriveService-&gt;files-&gt;insert($file, array( 'data' =&gt; 'file content goes here....', 'mimeType' =&gt; 'text/plain' )); ?&gt; </code></pre> <p>From what I understand, an application can use Service Account for Google Drive SDK on behalf of a user. Does that mean that there is no authentication question (request for permissions) to the user? Then how does the application authenticate itself? Or my understanding is probably wrong? Please help to enlighten me over here.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload