code: def clean(self):
          
          data = self.cleaned_data
          want_scope = data.get('scope') or 0
          refresh_token = data.get('refresh_token')
          access_token = getattr(refresh_token, 'access_token', None) if \
              refresh_token else \
              None
          has_scope = access_token.scope if access_token else 0
  
          # Only check if we've actually got a scope in the data
          # (read: All fields have been cleaned)
          if want_scope is not 0 and not scope.check(want_scope, has_scope):
              raise OAuthValidationError({'error': 'invalid_scope'})
  
          return data
docs: Make sure that the scope is less or equal to the previous scope!