Skip to content

Commit f892aa1

Browse files
committed
Update refresh token if needed when access token is updated
Thanks @hipslu for the pointer - fixes #50
1 parent 79caa29 commit f892aa1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

emailproxy.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
__author__ = 'Simon Robinson'
55
__copyright__ = 'Copyright (c) 2022 Simon Robinson'
66
__license__ = 'Apache 2.0'
7-
__version__ = '2022-08-19' # ISO 8601 (YYYY-MM-DD)
7+
__version__ = '2022-08-22' # ISO 8601 (YYYY-MM-DD)
88

99
import argparse
1010
import asyncore
@@ -355,6 +355,9 @@ def get_oauth2_credentials(username, password, connection_info, recurse_retries=
355355
access_token = response['access_token']
356356
config.set(username, 'access_token', OAuth2Helper.encrypt(cryptographer, access_token))
357357
config.set(username, 'access_token_expiry', str(current_time + response['expires_in']))
358+
if 'refresh_token' in response:
359+
config.set(username, 'refresh_token',
360+
OAuth2Helper.encrypt(cryptographer, response['refresh_token']))
358361
AppConfig.save()
359362
else:
360363
access_token = OAuth2Helper.decrypt(cryptographer, access_token)

0 commit comments

Comments
 (0)