oauth2_client/fetcher.py
def received_scope(self, token, default=""):
        """
        Extract scope granted by the provider from the token. The RFC isn't
        strict about the scope, so aren't we.

        Reference:
            > The authorization server MAY fully or partially ignore the scope
            > requested by the client, based on the authorization server policy or
            > the resource owner's instructions.  If the issued access token scope
            > is different from the one requested by the client, the authorization
            > server MUST include the "scope" response parameter to inform the
            > client of the actual scope granted.
            Source: https://tools.ietf.org/html/rfc6749#page-23

        Args:
            token: token object or dict returned from auth provider
            default: value to return when no scope info found

        Returns:
            str: scope as one string or default
        """
        # This accounts for all required cases and assigns a default properly,
        # don't change unless real issues caused.
        received = getattr(token, "scope", None)
        if received is None:
            received = token.get('scope', default)

        # check if we got what we asked for
        requested_list = self.requested_scope()
        requested_set = set(requested_list)
        received_set = set(received.split())
        if requested_set != received_set:
            log.warning(
                'Received different scope than requested. Requested: %s, received: %s. '
                'Just a heads-up, ignore this unless you are debugging permission issues.',
                requested_list, received.split()
            )

        return received

        Extract scope granted by the provider from the token. The RFC isn't
        strict about the scope, so aren't we.

        Reference:
            > The authorization server MAY fully or partially ignore the scope
            > requested by the client, based on the authorization server policy or
            > the resource owner's instructions.  If the issued access token scope
            > is different from the one requested by the client, the authorization
            > server MUST include the "scope" response parameter to inform the
            > client of the actual scope granted.
            Source: https://tools.ietf.org/html/rfc6749#page-23

        Args:
            token: token object or dict returned from auth provider
            default: value to return when no scope info found

        Returns:
            str: scope as one string or default
        
Extract scope granted by the provider from the token. The RFC isn't
strict about the scope, so aren't we.

> The authorization server MAY fully or partially ignore the scope
> requested by the client, based on the authorization server policy or
> the resource owner's instructions.  If the issued access token scope
> is different from the one requested by the client, the authorization
> server MUST include the "scope" response parameter to inform the
> client of the actual scope granted.
Extract scope granted by the provider from the token . The RFC isn ' t strict about the scope so aren ' t we . > The authorization server MAY fully or partially ignore the scope > requested by the client based on the authorization server policy or > the resource owner ' s instructions . If the issued access token scope > is different from the one requested by the client the authorization > server MUST include the " scope " response parameter to inform the > client of the actual scope granted .
def received_scope(self, token, default=""):
        received = getattr(token, "scope", None)
        if received is None:
            received = token.get('scope', default)
        requested_list = self.requested_scope()
        requested_set = set(requested_list)
        received_set = set(received.split())
        if requested_set != received_set:
            log.warning(
                'Received different scope than requested. Requested: %s, received: %s. '
                'Just a heads-up, ignore this unless you are debugging permission issues.',
                requested_list, received.split()
            )
        return received
def received_scope ( self , token , default = "" ) : received = getattr ( token , "scope" , None ) if received is None : received = token . get ( 'scope' , default ) requested_list = self . requested_scope ( ) requested_set = set ( requested_list ) received_set = set ( received . split ( ) ) if requested_set != received_set : log . warning ( 'Received different scope than requested. Requested: %s, received: %s. ' 'Just a heads-up, ignore this unless you are debugging permission issues.' , requested_list , received . split ( ) ) return received
Extract scope granted by the provider from the token.
Extract scope granted by the provider from the token .
"""
        Extract scope granted by the provider from the token. The RFC isn't
        strict about the scope, so aren't we.

        Reference:
            > The authorization server MAY fully or partially ignore the scope
            > requested by the client, based on the authorization server policy or
            > the resource owner's instructions.  If the issued access token scope
            > is different from the one requested by the client, the authorization
            > server MUST include the "scope" response parameter to inform the
            > client of the actual scope granted.
            Source: https://tools.ietf.org/html/rfc6749#page-23

        Args:
            token: token object or dict returned from auth provider
            default: value to return when no scope info found

        Returns:
            str: scope as one string or default
        """ # This accounts for all required cases and assigns a default properly, # don't change unless real issues caused. # check if we got what we asked for
scope as one string or default
scope as one string or default
str
self
token
token object or dict returned from auth provider
token object or dict returned from auth provider
default
value to return when no scope info found
value to return when no scope info found