-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
withPageAuthRequired on layout component #1643
Comments
+1, I also encountered this today and feel it would be convenient to be able to do this once in a layout rather than developers needing to add it on every page for many use cases (not to mention safer, since developers may forget and accidentally leave a page exposed). |
Edit: This broke
|
FWIW this is what I've done, feels pretty bad but does seem to work: export default withPageAuthRequired(
Layout as AppRouterPageRoute,
) as React.FC; |
|
Checklist
Description
Related to some of the other App Router bugs open.
Instead of doing the
withPageAuthRequired
on each Page, I'd like to just put it on the layout.e.g.:
This code seems to work as expected but will throw a typescript error:
Seems like only the typing would need to be enhanced.
It also be nice to be able to access the current route in the
returnTo
func which makes this use case even better:Reproduction
Use above code example.
Additional context
No response
nextjs-auth0 version
3.5.0
Next.js version
14.1
Node.js version
18.17.1
The text was updated successfully, but these errors were encountered: