Which Method is the Best and lightweight the Route Guard using NEXT 14 ( App router) both of serve
Unanswered
Md.Mohon posted this in #help-forum
Md.MohonOP
I need to protect a route so i need a lightweight auth guard using app router next 14. So which method i can follow and can you please send a any sample or any blog.
15 Replies
how lightweight of an auth do you need? @Md.Mohon
the most lightweight would be an env key you use, which the url must include as search params
Md.MohonOP
i need the faster and not need to the component authentication checking that's i mean.
can you send me any sample or any blog the best wey in the route guard in Next 14 app router?
@Arinji elaborate
Md.MohonOP
sorry?
can you elaborate on "not need to the component authentication checking"
Md.MohonOP
sorry typing mistake. it's have "not need to more time to component authentication checking"
yea so just do what i said, have an env variable.. like for example
123456
and make it so you make requests to page as /home?key=123456
123456
and make it so you make requests to page as /home?key=123456
if the key !== the env variable, its an unauthenticated request
@Md.Mohon
Md.MohonOP
so basically i need a route protection @Arinji
there are a lot of ways to protect routes
go through that