Next.js Discord

Discord Forum

Ensure that the second page is only accessible to users who navigate to it from the first page.

Unanswered
Temesgen posted this in #help-forum
Open in Discord
I have two pages: http://localhost:3000/payment.tsx( server side) and http://localhost:3000/registration.tsx ( client side) . The logic is such that after filling the necessary student registration details, the user is redirected to the payment checkout page to make payment, but they shouldn't be able to proceed with the payment unless they've completed the registration.Example. users to be directed to http://localhost:3000/payment.tsx when they click the "register" button on http://localhost:3000/registration.tsx, but must prevent users from accessing http://localhost:3000/payment directly via the browser's address bar. How can I achieve this in app router ?

1 Reply

Server side cookies and middleware