Next.js Discord

Discord Forum

Design Question

Answered
Varun posted this in #help-forum
Open in Discord
Just getting started with my first react/next app and had a question about routing. I'm having users Sign In With Google and on successful login want to take them to their profile page. My first instinct was just to route them to another page with searchparams for their email but that doesn't seem very secure. Any help would be appreciated!
Answered by Peterbald
You can prevent direct to that url in middleware using session
View full answer

6 Replies

yea and then what stops someone from just going directly to that url?
for a diff user
Peterbald
You can prevent direct to that url in middleware using session
Answer
Peterbald
There is middleware.js/middleware.ts in Next.js project. You can verify if this user is vaild user for some url...
ah i see thanks