Skip to content
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

Documentation for withPageAuthRequiredAppRouter wrong #1642

Open
6 tasks done
perenstrom opened this issue Jan 21, 2024 · 1 comment · May be fixed by #1649
Open
6 tasks done

Documentation for withPageAuthRequiredAppRouter wrong #1642

perenstrom opened this issue Jan 21, 2024 · 1 comment · May be fixed by #1649

Comments

@perenstrom
Copy link

Checklist

Description

The code example in the documentation for withPageAuthRequiredAppRouter contains a non working example:

// app/protected-page/page.js
import { withPageAuthRequired } from '@auth0/nextjs-auth0';

export default function withPageAuthRequired(ProtectedPage() {
  return <div>Protected content</div>;
}, { returnTo: '/protected-page' });

The withPageAuthRequired helper should wrap function ProtectedPage() ..., as it is now, the example exports a new function called withPageAuthRequired.

Reproduction

Copy the code from the example.

Additional context

No response

nextjs-auth0 version

3.5.0

Next.js version

14.1.0

Node.js version

20.11.0

@seanparmelee seanparmelee linked a pull request Jan 26, 2024 that will close this issue
2 tasks
@samriddhi
Copy link

Hi, I have a custom login page and I would like to return my protected page to that custom login.
No matter what I do it still goes to the universal login which I do not want to use from Auth0

export default withPageAuthRequired(async function ProtectedPage() {
   return (
     <ImageUploadSection />
   );
}, {returnTo: '/faq'})

Is there a fix for this? or a workaround besides checking if the user is logged in on every page?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants