Google calendar v3 returns 403 Insufficient Permission
Asked Answered
C

4

7

I've been trying to access Calendar v3 API with a service account. I have already added the scope https://www.googleapis.com/auth/calendar from the admin console and shared my calendar with that service account's email address.

I have also been accessing https://www.googleapis.com/auth/coordinate scope with the very same service account and it works fine.

Also, tried revoking access as said here: Why is Google Calendar API (oauth2) responding with 'Insufficient Permission'?

All that, and I am still getting;

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

Am i missing something?

Catamnesis answered 11/10, 2013 at 20:28 Comment(0)
A
4

Try to add to you scope 'userinfo.email' and enable in Developers console "Contacts API" and "Google+ API". I've spent 2 weeks searching for answer to this question, and this trick has worked for me.

Angarsk answered 3/12, 2014 at 15:51 Comment(1)
@erjoalgo did you use Ruby and Ruby on Rails? I ask this question because as I see from SO tags you're writing on Python.Angarsk
W
0

Did you have any joy with this? I've 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 sharing the calendar with the service email account.

Walli answered 11/11, 2014 at 19:29 Comment(3)
Do you just mean with the overall Google Account that you're using for the service? Are you able to call something like listCalendarList, or are you only able to operate on specific calendars?Bindle
I can do all sorts of Google_Service_Calendar_Event stuff now, are you stuck on something?Walli
I wasn't able to get the Service Account stuff working. I could do basic calls, but without being in a Google Apps domain it seemed limited. Switched to using OAuth which is less convenient for our application, but the calls actually work.Bindle
S
0

I think if you use Google Calendar Quickstart for Ruby, I think you should delete your credentials in the specified path...I try it and it works well... You can see where the credentials is put in here

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

In your home dir, you may find a dir which Google store your credentials after you approve Google request to access your data.

Stayathome answered 19/1, 2016 at 16:10 Comment(0)
A
0

first of all change

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

to

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

and then in your documents folder delete .credentials folder

and run again.

this worked for me!

Audrieaudris answered 27/3, 2018 at 6:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.