我已成功在Google App Engine上创建了一个与Gmail API交互的python web-app。我现在想得到的是,当给出权限时,我的应用程序还会创建一个用户帐户,用户可以使用他们的Google帐户登录。这将阻止用户不得不为我的应用输入另一个密码。向GMail API授权添加单点登录
总之,目前的工作流程是: 1.用户通过电子邮件和密码输入创建帐户 2.用户授权Gmail的存取
我想获得的是:1。 用户连接谷歌帐户和随即获得一个帐户并验证GMail访问
这样做的最佳方法是什么?
我目前的google API代码如下所示。直接从谷歌这里的例子:https://developers.google.com/api-client-library/python/guide/google_app_engine
from apiclient.discovery import build
from google.appengine.ext import webapp
from oauth2client.appengine import OAuth2Decorator
decorator = OAuth2Decorator(
client_id='your_client_id',
client_secret='your_client_secret',
scope='https://www.googleapis.com/auth/calendar')
service = build('calendar', 'v3')
class MainHandler(webapp.RequestHandler):
@decorator.oauth_required
def get(self):
# Get the authorized Http object created by the decorator.
http = decorator.http()
# Call the service using the authorized Http object.
request = service.events().list(calendarId='primary')
response = request.execute(http=http)