NextJs routing for SignIn
Unanswered
Varun posted this in #help-forum
VarunOP
I have a website where users can sign in(tunedinapp.com) and right now after a user signs in we redirect them to the /web route with their email as a searchPAram. If they reload on this route, they get a 404 page. I added a middleware.js and now when they reload it takes them back to this page. But this causes an obvious security risk because now anyone can add the url as a searchparam to the web route to access their account. Is there a way to verify that a user has signedin using browser history or something. If it matters, I'm using firebase for authentication
3 Replies
@Varun I have a website where users can sign in(tunedinapp.com) and right now after a user signs in we redirect them to the /web route with their email as a searchPAram. If they reload on this route, they get a 404 page. I added a middleware.js and now when they reload it takes them back to this page. But this causes an obvious security risk because now anyone can add the url as a searchparam to the web route to access their account. Is there a way to verify that a user has signedin using browser history or something. If it matters, I'm using firebase for authentication
hi, you could check the example from firebase how they handle authentication with nextjs for app router
https://github.com/firebase/friendlyeats-web/blob/facbeeb94a8c8f12ec616d5e8a4f2e7d6f5f2552/nextjs-end/src/lib/firebase/firebase.js#L27
https://github.com/firebase/friendlyeats-web/blob/facbeeb94a8c8f12ec616d5e8a4f2e7d6f5f2552/nextjs-end/src/lib/firebase/firebase.js#L27
VarunOP
alr thx ill check it out