async def auth(request: fastapi.Request) -> RedirectResponse:
        """
        Handles the OAuth callback for Hugging Face authentication.

        Args:
            request (fastapi.Request): The incoming request object.

        Returns:
            RedirectResponse: A response object that redirects the user to the appropriate page.

        Raises:
            MismatchingStateError: If there is a state mismatch, likely due to a corrupted cookie.
                In this case, the user is redirected to the login page after clearing the relevant session keys.

        Notes:
            - If the state mismatch occurs, it is likely due to a bug in authlib that causes the token to grow indefinitely
              if the user tries to login repeatedly. Since cookies cannot exceed 4kb, the token will be truncated at some point,
              resulting in a lost state. The workaround is to delete the cookie and redirect the user to the login page again.
            - See https://github.com/lepture/authlib/issues/622 for more details.
        """
        """Endpoint that handles the OAuth callback."""
        try:
            oauth_info = await oauth.huggingface.authorize_access_token(request)  # type: ignore
        except MismatchingStateError:
            # If the state mismatch, it is very likely that the cookie is corrupted.
            # There is a bug reported in authlib that causes the token to grow indefinitely if the user tries to login
            # repeatedly. Since cookies cannot get bigger than 4kb, the token will be truncated at some point - hence
            # losing the state. A workaround is to delete the cookie and redirect the user to the login page again.
            # See https://github.com/lepture/authlib/issues/622 for more details.
            login_uri = "/login/huggingface"
            if "_target_url" in request.query_params:
                login_uri += "?" + urllib.parse.urlencode(  # Keep same _target_url as before
                    {"_target_url": request.query_params["_target_url"]}
                )
            for key in list(request.session.keys()):
                # Delete all keys that are related to the OAuth state
                if key.startswith("_state_huggingface"):
                    request.session.pop(key)
            return RedirectResponse(login_uri)

        request.session["oauth_info"] = oauth_info
        return _redirect_to_target(request)

        Handles the OAuth callback for Hugging Face authentication.

        Args:
            request (fastapi.Request): The incoming request object.

        Returns:
            RedirectResponse: A response object that redirects the user to the appropriate page.

        Raises:
            MismatchingStateError: If there is a state mismatch, likely due to a corrupted cookie.
                In this case, the user is redirected to the login page after clearing the relevant session keys.

        Notes:
            - If the state mismatch occurs, it is likely due to a bug in authlib that causes the token to grow indefinitely
              if the user tries to login repeatedly. Since cookies cannot exceed 4kb, the token will be truncated at some point,
              resulting in a lost state. The workaround is to delete the cookie and redirect the user to the login page again.
            - See https://github.com/lepture/authlib/issues/622 for more details.
        
src/autotrain/app/oauth.py