Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 92f28e7

Browse files
criles25lbalmaceda
authored andcommitted
Add scope to refresh_token
1 parent 01a1a52 commit 92f28e7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

auth0/v3/authentication/get_token.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ def login(self, client_id, client_secret, username, password, scope, realm,
164164
}
165165
)
166166

167-
def refresh_token(self, client_id, client_secret, refresh_token, grant_type='refresh_token'):
167+
def refresh_token(self, client_id, client_secret, refresh_token, scope,
168+
grant_type='refresh_token'):
168169
"""Calls /oauth/token endpoint with refresh token grant type
169170
170171
Use this endpoint to refresh an access token, using the refresh token you got during authorization.
@@ -179,6 +180,9 @@ def refresh_token(self, client_id, client_secret, refresh_token, grant_type='ref
179180
180181
refresh_token (str): The refresh token returned from the initial token request.
181182
183+
scope (str): String value of the different scopes the client is asking for.
184+
Multiple scopes are separated with whitespace.
185+
182186
Returns:
183187
access_token, id_token
184188
"""
@@ -189,6 +193,7 @@ def refresh_token(self, client_id, client_secret, refresh_token, grant_type='ref
189193
'client_id': client_id,
190194
'client_secret': client_secret,
191195
'refresh_token': refresh_token,
196+
'scope': scope,
192197
'grant_type': grant_type
193198
}
194199
)

auth0/v3/test/authentication/test_get_token.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def test_refresh_token(self, mock_post):
104104
g.refresh_token(client_id='cid',
105105
client_secret='clsec',
106106
refresh_token='rt',
107+
scope='s',
107108
grant_type='gt')
108109

109110
args, kwargs = mock_post.call_args
@@ -113,5 +114,6 @@ def test_refresh_token(self, mock_post):
113114
'client_id': 'cid',
114115
'client_secret': 'clsec',
115116
'refresh_token': 'rt',
117+
'scope': 's',
116118
'grant_type': 'gt'
117119
})

0 commit comments

Comments
 (0)