useAuthenticatedBlitzContext doesn not populate next url param on redirect (app router)
- Dominant language
- TypeScript
- Stars
- 14.1k
- Forks
- 803
- PR merge metrics
- No merged PRs in 30d
Description
### 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 (
My Page
);
}
```
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
Contributor guide
Research direction
Start with the app-router usage in /app/my-page.tsx and trace useAuthenticatedBlitzContext with redirectTo "/auth/login" while unauthenticated. Reproduce the redirect from /my-page and verify that the resulting login URL includes a next parameter pointing back to /my-page.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js, typescript
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100