For testing our application I need to insert/update google calendar events and verify edge cases like if a meeting invite is > 30 days it should not be shown to end user. I am doing this setup for a single gmail id [email protected] and trying to manipulate events to cover all the edge cases.
Following this link - https://developers.google.com/calendar/v3/reference/events/insert
1) I created a new project https://console.cloud.google.com.
2) Enabled Google Calendar API
3) Set up OAuth Client for credentials.json
4) Ran python quick start to get 10 calendar event - to verify step 3 was correct.
5) Now to insert an event added following scope on consent screen https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/calendar.events
6) Regenerate credential, so that it does have newly added scope for inserting event.
I am getting following error message - HttpError 403 when requesting https://www.googleapis.com/calendar/v3/calendars/primary/events?alt=json returned "Insufficient Permission: Request had insufficient authentication scopes."
I have also tried using email id in place of "primay" and again ending up with the same error.
I had the same problem (=error message). Check out in the top of the demo software the following lines:
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/calendar.readonly']
and modify to
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/calendar']
then delete your token.pickle file, then rerun your script.
If your all credentials is done perfectly. you can just simplly edit a line Go to your index.php or your filename where you generated get client and overrice the line below
$client->setScopes(Google_Service_Calendar::CALENDAR_READONLY);
To
$client->setScopes(Google_Service_Calendar::CALENDAR);
and also make sure you have permission to create events.
Hope it will helped.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With