code: def identify(self, req, resp, resource, uri_kwargs):
          
          header = req.get_header("Authorization", False)
          auth = header.split(" ") if header else None
  
          if auth is None or auth[0].lower() != 'basic':
              return None
  
          if len(auth) != 2:
              raise HTTPBadRequest(
                  "Invalid Authorization header",
                  "The Authorization header for Basic auth should be in form:\n"
                  "Authorization: Basic <base64-user-pass>"
              )
  
          user_pass = auth[1]
  
          try:
              decoded = base64.b64decode(user_pass).decode()
  
          except (TypeError, UnicodeDecodeError, binascii.Error):
              raise HTTPBadRequest(
                  "Invalid Authorization header",
                  "Credentials for Basic auth not correctly base64 encoded."
              )
  
          username, _, password = decoded.partition(":")
          return username, password
docs: Identify user using Authenticate header with Basic auth.