Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion flask_oauthlib/provider/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,25 @@ def confirm_redirect_uri(self, client_id, code, redirect_uri, client,

return grant.redirect_uri == redirect_uri

def get_original_scopes(self, refresh_token, request, *args, **kwargs):
"""Get the list of scopes associated with the refresh token.

This method is used in the refresh token grant flow. We return
the scope of the token to be refreshed so it can be applied to the
new access token.
"""
log.debug('Obtaining scope of refreshed token.')
tok = self._tokengetter(refresh_token=refresh_token)
return tok.scopes

def confirm_scopes(self, refresh_token, scopes, request, *args, **kwargs):
"""Ensures the requested scope matches the scope originally granted
by the resource owner. If the scope is omitted it is treated as equal
to the scope originally granted by the resource owner
to the scope originally granted by the resource owner.

DEPRECATION NOTE: This method will cease to be used in oauthlib>0.4.2,
future versions of ``oauthlib`` use the validator method
``get_original_scopes`` to determine the scope of the refreshed token.
"""
if not scopes:
log.debug('Scope omitted for refresh token %r', refresh_token)
Expand Down