Has been working fine with hugging face for about a week until today, when on login I started getting errors like: Missing state on session in the authenticator.authenticate() call.
export async function loader(args: LoaderFunctionArgs) {
const searchParams = new URL(args.request.url).searchParams
const redirectTo = searchParams.get("redirectTo")
try {
return await authenticator.authenticate(
huggingfaceAuthenticator,
args.request,
{
successRedirect: "/dashboard",
throwOnError: true,
}
)
} catch (error) {
if (error instanceof Response) {
// Let's inject the cookie to set
if (redirectTo) {
error.headers.set(
"set-cookie",
await signinRedirectCookie.serialize(redirectTo)
)
}
return error
}
return redirect(
"/signin?failed=" + encodeURIComponent((error as Error).message)
)
}
}
export const signinRedirectCookie = createCookie("signin-redirect", {
sameSite: "lax",
path: "/",
httpOnly: true,
secrets: [process.env.COOKIE_SECRET!],
secure: false, // process.env.NODE_ENV === "production", // enable this in prod only
})
Nothing has changed in my code, but it seems I am unable to manually provide a state? Not sure what they changed, but it seems I am unable to accommodate for it with existing configuration options?
Failed to verify user ECONNREFUSED: Failed to connect this line gave it away, the DB wasn't running on my local machine. I wished that error was passed through maybe?
Has been working fine with hugging face for about a week until today, when on login I started getting errors like:
Missing state on session
in theauthenticator.authenticate()
call.My config looks like:
and:
Nothing has changed in my code, but it seems I am unable to manually provide a state? Not sure what they changed, but it seems I am unable to accommodate for it with existing configuration options?
It also causes the browser to loop:
Edit: Seems to be related to this chunk of code: https://github.com/sergiodxa/remix-auth-oauth2/blob/main/src/index.ts#L190-L200
Debug looks like: