def get_id_token(client_secrets_file, extra_args):
storage = oauth2client.file.Storage('credentials.dat')
credentials = storage.get()
if not credentials or credentials.invalid:
flow = oauth2client.client.flow_from_clientsecrets(
client_secrets_file, scope='email')
credentials = oauth2client.tools.run_flow(
flow, storage, flags=extra_args)
# The ID token is used by Cloud Endpoints, not the access token.
id_token = credentials.token_response['id_token']
return id_token
评论列表
文章目录