Skip to content

Commit

Permalink
Merge pull request googleapis#106 from Psynbiotik/SaveTokenPath
Browse files Browse the repository at this point in the history
Save the token path used for updating with a refreshed token later
  • Loading branch information
Narcolapser authored Jul 20, 2018
2 parents ff01f85 + c916e96 commit cf536d2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions O365/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __init__(self):
self.client_id = None
self.client_secret = None
self.token = None

self.token_path = None
self.proxy_dict = None

def is_valid(self):
Expand Down Expand Up @@ -134,6 +134,7 @@ def oauth2(client_id, client_secret, store_token=True, token_path=None):
connection.api_version = '2.0'
connection.client_id = client_id
connection.client_secret = client_secret
connection.token_path = token_path

if not store_token:
delete_token(token_path)
Expand Down Expand Up @@ -214,7 +215,7 @@ def get_response(request_url, **kwargs):
token = connection.oauth.refresh_token(Connection._oauth2_token_url, client_id=connection.client_id,
client_secret=connection.client_secret)
log.info('New token fetched')
save_token(token)
save_token(token, connection.token_path)

response = connection.oauth.get(request_url, **con_params)

Expand Down

0 comments on commit cf536d2

Please sign in to comment.