blitz
blitz copied to clipboard
useAuthenticatedBlitzContext doesn not populate next url param on redirect (app router)
What is the problem?
When using useAuthenticatedBlitzContext in the app router, the next
url parameter is not set after redirection.
What are detailed steps to reproduce this?
Create /app/my-page.tsx
import { Metadata } from "next";
import { useAuthenticatedBlitzContext } from "src/blitz-server";
export const metadata: Metadata = {
title: "My Page"
};
export default async function MyPage() {
await useAuthenticatedBlitzContext({
redirectTo: "/auth/login"
});
return (
<div>
My Page
</div>
);
}
and open http://localhost:3000/my-page (while NOT being authenticated).
You will see that you do get redirected to /auth/login but the next
url parameter is missing