Skip to content

Commit 36951ae

Browse files
authored
Merge pull request jupyterhub#157 from betatim/refresh-token
[MRG] Add refresh token to auth_state if it is available
2 parents 915dad0 + 929329a commit 36951ae

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

oauthenticator/generic.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ def authenticate(self, handler, data=None):
106106
resp_json = json.loads(resp.body.decode('utf8', 'replace'))
107107

108108
access_token = resp_json['access_token']
109+
refresh_token = resp_json.get('refresh_token', None)
109110
token_type = resp_json['token_type']
110111

111112
# Determine who the logged in user is
@@ -134,6 +135,7 @@ def authenticate(self, handler, data=None):
134135
'name': resp_json.get(self.username_key),
135136
'auth_state': {
136137
'access_token': access_token,
138+
'refresh_token': refresh_token,
137139
'oauth_user': resp_json,
138140
}
139141
}

oauthenticator/tests/test_generic.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,4 @@ def test_generic(generic_client):
3737
auth_state = user_info['auth_state']
3838
assert 'access_token' in auth_state
3939
assert 'oauth_user' in auth_state
40-
41-
40+
assert 'refresh_token' in auth_state

0 commit comments

Comments
 (0)