code: def authenticate_credentials(self, token):
          
  
          try:
              user_info = self.get_user_info(token)
          except UserInfoRetrievalFailed:
              msg = 'Failed to retrieve user info. Unable to authenticate.'
              logger.error(msg)
              raise exceptions.AuthenticationFailed(msg)
  
          user, __ = get_user_model().objects.get_or_create(username=user_info['username'], defaults=user_info)
  
          if not user.is_active:
              raise exceptions.AuthenticationFailed('User inactive or deleted.')
  
          return user, token
docs: Validate the bearer token against the OAuth provider.
  
          Arguments:
              token (str): Access token to validate
  
          Returns:
              (tuple): tuple containing:
  
                  user (User): User associated with the access token
                  access_token (str): Access token
  
          Raises:
              AuthenticationFailed: The user is inactive, or retrieval of user info failed.