def first_auth(self, client_secrets):
"""Authenticate with Google API."""
flow = client.flow_from_clientsecrets(
client_secrets,
scope=[
'https://www.googleapis.com/auth/admin.directory.group.readonly', # noqa
'https://www.googleapis.com/auth/admin.directory.group.member.readonly', # noqa
'https://www.googleapis.com/auth/apps.groups.settings'
],
redirect_uri='urn:ietf:wg:oauth:2.0:oob')
logger.debug('Generating authorization URL.')
auth_uri = flow.step1_get_authorize_url()
webbrowser.open(auth_uri)
auth_code = input('Enter the auth code: ')
logger.debug('Generating credentials.')
self.credentials = flow.step2_exchange(auth_code)
评论列表
文章目录