1
votes

right now i'm using google-calendar-api with Laravel, i want to create a reminder, and let the user decides if he wants to shows it in his Google Calendar (based in his gmail account).
Right now this code works fine: enter image description here

I got an error when trying to add an attendee, Googling i found out that you need to "impersonate" the user you want to invite, so i tried the next approach:

enter image description here

And getting this error:

enter image description here

What do you guys think am i doing wrong? In my Google Api Console i'm using a Service Account, i tried with several keys, i enabled Domain Wide Delegation: enter image description here

Nothing works, as i said, i can create and list the events, but can't invite anyone.

Thanks in advance!

1
Please edit your question and include your code not pictures of your code.DaImTo
Did you grant domain-wide delegation to the service account? Checking Habilitar delegacion en todo el dominio de G Suite is only the first step, check and follow this. Also, the user who created the event is by default an attendee, you don't need to add it. Why are you doing that?Iamblichus

1 Answers

0
votes

The error message

the client is not authorized to request a token using this method

Means that the client credetials that you created on Google developer console do not match the login method you are using

You apear to be using code designed for use with a service account

    // Create and configure a new client object.        
    $client = new Google_Client();
    $client->useApplicationDefaultCredentials();
    $client->addScope([YOUR SCOPES HERE]);
    return $client;

To use this you need to create service account credentials on Google developer console. You have not.