code: def authenticate(self, request):
          
          auth = get_authorization_header(request).split()
  
          if not auth or auth[0].lower() != b'token':
              return None
  
          if len(auth) == 1:
              msg = _('Invalid auth token header. No credentials provided.')
              raise AuthenticationFailed(msg)
          elif len(auth) > 2:
              msg = _('Invalid auth token.')
              raise AuthenticationFailed(msg)
  
          try:
              token = urlsafe_b64decode(auth[1])
          except ValueError:
              msg = _('Invalid auth token.')
              raise AuthenticationFailed(msg)
  
          return self.authenticate_credentials(token, request)
docs: Authenticate the request and return a two-tuple of (user, token).