Unauthorized interaction with google calendar API v3

半世苍凉 提交于 2019-12-04 14:46:00

I don't think service accounts are available for Calendar API. The service account has no calendar of its own.

user1260486

Service Accounts are available and work with Calendar API for me.

You need to change your following statement:

credentials = SignedJwtAssertionCredentials('2127313127654990@developer.gserviceaccount.com', key, scope=['https://www.googleapis.com/auth/calendar', 'https://www.googleapis.com/auth/calendar.readonly'])

to

credentials = SignedJwtAssertionCredentials('2127313127654990@developer.gserviceaccount.com', key, scope=['https://www.googleapis.com/auth/calendar', 'https://www.googleapis.com/auth/calendar.readonly'], prn='requestor@domain.com')
schillingt

The service accounts do work with the Calendar API. You have to also grant access on your domain management as well.

Do as user1260486 and btspierre said, and add the "prn=requestor@domain.com" to the constructor for SignedJWTAssertionCredentials.

Then go to your domain management and add your client_id access to the API.

Here's a walkthrough about it. For the scope specify "https://www.googleapis.com/auth/calendar, https://www.googleapis.com/auth/calendar.readonly"

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!