OAuth2 Flow Object Construction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set up a Flow object that reads the clients from our secrets file with the | |
# corresponding scope | |
flow = google_auth_oauthlib.flow.Flow.from_client_secrets_file( | |
'client_secrets.json', | |
scopes=['https://www.googleapis.com/auth/calendar']) | |
# indicate the redirect URI that we placed in the console redirect URI when we | |
# created the oauth credentials | |
flow.redirect_uri = 'http://localhost:8080/oauth2redirect' | |
# generates the auth URL that we need to redirect users to where the user | |
# gets the oauth consent screen and we get the access code to later exchange for an | |
# auth token | |
authorization_url, _ = flow.authorization_url( | |
# enables us to grab a refresh token without the user granting us access | |
# a second time if needed | |
access_type='offline', | |
include_granted_scopes='true') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment