Skip to content
Advertisement

Google API – Auth server to server

I need a service to manipulate emails in a gmail account within a project developed in PHP Symfony…

I found this example : https://github.com/googleapis/google-api-php-client/blob/main/docs/oauth-server.md But more confusing than helping…

I wrote this code :

src/Service/Gmail.php

JavaScript

Then I followed the steps described in Google Workspace for developers :

  1. Create a new project : https://developers.google.com/workspace/guides/create-project?hl=en
  2. Enable Gmail API : https://developers.google.com/workspace/guides/enable-apis?hl=en
  3. Create credentials for web application server-side : https://developers.google.com/workspace/guides/create-credentials?hl=en

But at this point I have no idea what type of credentials I need : “OAuth client ID” or a “Service account” ??? If I choose “Oauth client ID” I suppose I have to use the application type “Web application” with server side url ? Or do I choose “Service account” ?

With service account I got this error :

JavaScript

Advertisement

Answer

You have not proeprly authorized your service account to delegate to a user on your domain.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement