Google calendar v3 returns 403 Not enough permission

I am trying to access Calendar v3 API with a service account. I already added the https://www.googleapis.com/auth/calendar area from the admin console and shared my calendar with this email address of the service account.

I also accessed https://www.googleapis.com/auth/coordinate with the same service account and it works great.

Also, I tried to revoke access, as it is said here: Why does the Google Calendar API (oauth2) respond with "Insufficient permission"?

All this, and I still get it;

{"error"=> {"errors"=> [{"domain"=>"global", "reason"=>"insufficientPermissions", "message"=>"Insufficient Permission"}], "code"=>403, "message"=>"Insufficient Permission"}} 

Am I missing something?

+6
source share
4 answers

Try adding the “userinfo.email” area to you and turning on the “Contacts” and “Google+ APIs” in the developers console. I spent 2 weeks finding the answer to this question, and this trick worked for me.

+4
source

Have you had the joy of this? I hit the same brick wall.

UPDATE:

 $key = file_get_contents($key_file_location); $scopes = array('https://www.googleapis.com/auth/calendar'); $cred = new Google_Auth_AssertionCredentials( $service_account_name, $scopes, $key ); 

This worked for my authorization after exchanging the calendar with the service account.

0
source

I think that if you use Google Calendar Quickstart for Ruby, I think you should delete your credentials at the specified path ... I tried and it works well ... You can see where the credentials are entered here

 CREDENTIALS_PATH = File.join(Dir.home, '.credentials', "calendar-ruby-quickstart.yaml") 

In the home directory, you can find the directory in which Google stores your credentials after you approve a Google request to access your data.

0
source

change first

 static string[] Scopes = { CalendarService.Scope.CalendarReadonly }; 

to

 static string[] Scopes = { CalendarService.Scope.Calendar }; 

and then in the docs folder delete the .credentials folder

and run again.

it worked for me!

0
source

Source: https://habr.com/ru/post/955805/


All Articles