def process_auth(code): """ The second step in the authorization chain. After the first step finished, a code was passed back to the website from google. This function exchanges that code for credentials, including a refresh token that can be used to get credentials without further authorization. It stores the credentials and returns them to the caller. """ credentials=FLOW.step2_exchange(code) storage = Storage(CALENDAR_DATA) storage.put(credentials) return credentials
def get_credentials(): # To disable the local server feature, uncomment the following line: # If the Credentials don't exist or are invalid, run through the native client # flow. The Storage object will ensure that if successful the good # Credentials will get written back to a file. storage = Storage(CALENDAR_DATA) credentials = storage.get() if credentials is None or credentials.invalid: credentials = run(FLOW, storage) return credentials
def get_credentials(): # To disable the local server feature, uncomment the following line: # If the Credentials don't exist or are invalid, run through the native client # flow. The Storage object will ensure that if successful the good # Credentials will get written back to a file. storage = Storage(CALENDAR_DATA) credentials = storage.get() if credentials is None or credentials.invalid: credentials = run(FLOW,storage) return credentials
def process_auth(code): """ The second step in the authorization chain. After the first step finished, a code was passed back to the website from google. This function exchanges that code for credentials, including a refresh token that can be used to get credentials without further authorization. It stores the credentials and returns them to the caller. """ credentials = FLOW.step2_exchange(code) storage = Storage(CALENDAR_DATA) storage.put(credentials) return credentials
def get_credentials(): """ Retrieves the locally stored credentials. If they are invalid/expired, get a new set using the refresh token and store them locally. """ # If the Credentials don't exist or are invalid, run through the native client # flow. The Storage object will ensure that if successful the good # Credentials will get written back to a file. storage = Storage(CALENDAR_DATA) credentials = storage.get() if credentials is None or credentials.invalid: credentials = run(FLOW,storage) return credentials
def get_credentials(): """ Retrieves the locally stored credentials. If they are invalid/expired, get a new set using the refresh token and store them locally. """ # If the Credentials don't exist or are invalid, run through the native # client flow. The Storage object will ensure that if successful the good # Credentials will get written back to a file. storage = Storage(CALENDAR_DATA) credentials = storage.get() if credentials is None or credentials.invalid: credentials = run(FLOW, storage) return credentials
def process_auth(code): credentials = FLOW.step2_exchange(code) storage = Storage(CALENDAR_DATA) storage.put(credentials) return credentials
def process_auth(code): credentials=FLOW.step2_exchange(code) storage = Storage(CALENDAR_DATA) storage.put(credentials) return credentials