0
votes

We are working on an app with Google Calendar Integration for Google marketplace users. Many of the links in the documentation https://developers.google.com/google-apps/marketplace/best_practices is not working. Can anybody point me to work in 2-Legged OAuth with RESTful Google Calendar API V3 for marketplace users? TIA, Riyaz .A

1
See: stackoverflow.com/questions/17020076/… it refers to the Admin SDK API but the process would be the same for Calendar v3. - Jay Lee
We have released a new experience for the Google Apps Marketplace (see announcement). You can read details in our Developer Documentation. In the new experience, we have moved away from 2-legged OAuth. You should use Service Accounts. There is good documentation for Drive that should point you in the right direction. - jonathanberi

1 Answers

0
votes

Download the below library it supporting 2legged oauth

google-api-python-client==1.0beta4

and make sure your manifest contains updated calendar(v3) scopes then

from apiclient.oauth import TwoLeggedOAuthCredentials
from apiclient.discovery import build
import httplib2

credentials = TwoLeggedOAuthCredentials(OAUTH_CONSUMER_KEY,OAUTH_CONSUMER_SECRET,'referer')
credentials.requestor = user_email
http = httplib2.Http()
http = credentials.authorize(http)
calendar_service = build('calendar', 'v3', http=http)
list = calendar_service.events().list(calendarId="primary").execute()