How to Protect Routes in Next.js 14 in 4 Ways - Private Routes - Authorization

preview_player
Показать описание

01:15 Build Navbar for Routes
04:55 Create a session variable

#nextjs13 #auth #routes #authorisation #nextjs

React tutorials:

JavaScript Tutorials and Projects:

Angular Tutorials:

Angular 16 Crash Course For Begineers:

Tech Tutorials - Random:

Join our facebook group:

Contact us for development services:
Рекомендации по теме
Комментарии
Автор

Bro 😂 more than 10 tutorials without any solution, and you in one video fix my whole problem with authorization love you bro

yacine
Автор

man i just watched this video along with your other tutorials and all i can say is that you explain it very well and very informative. you have gain a subscriber in me, keep it up and thank you for sharing your knowledge

joshuaclaracay
Автор

best video on youtube explaining public and private routing with next.js. Thank you brother. Great help!!

ziiuhpq
Автор

Thank you. I searched before writing the auth code and saw it and it was so beneficial!

xstxlml
Автор

Best video about protected routes in nextjs on youtube! 👏👏

anderwilliangomes
Автор

but in realword project session or logged in state in not stored in a file
then how to do this? like I have stored jwt token in localstorage

Can you help me?

AyanGhosh-vjui
Автор

thanks mate!! your examples has perfect to understand and very simple to apply.

Nintendinho
Автор

Hi, you are reading sessionStatus from a hardcoded variable from another file, could anyone please tell me how to read variable like sessionStatus from redux, though i know redux is client side store and middleware run on server, but is there any other way to check if user is already logged in in case of real authentication system

sagarmusic
Автор

isn't redirect() only used in server components ?
Can you please explain this

RitikRaj-wesc
Автор

Thank you, man! This kind of content is very helpful, u know, showing many ways of doing the same thing, It's incredible, 'cause most of the time, we have to adapt our solution or one works very well but one doesn't, I hope for content like this. One more subscriber!

abnersousa
Автор

very good tutorial with simple and straight forward example. There are some tutorials around that the person put so many not important things around the theme he wants to teach that makes the understanding of the theme just too complex. Not you. Very straight forward.

ThugLifeModafocah
Автор

Hello ! I have a question, i have a fetch that needs authorization headers for the backend, and when i try to build my next js project, it gives me an error because the api call fails. What can i do in this cases?

alexisgraff
Автор

implementation of middleware is nor 100% correct. NextJs provides a dedicated variable for comparing route names. Please use that

tanmaypatra
Автор

Very well explained. Thank you for this tutorial. Keep it up.

danish
Автор

its good tut. its clear and strait forward. the only thing I find missing is the use of typescript. you use everywhere type any. thats a shame. good luck brother

lizard-wizard
Автор

i have issue with the last one authentication . how do you manage to protect dynamic route eg 'user/id'

pankajkoirala
Автор

how to protect all page routes without writing all routes one by one in middleware? like: const protectedRoutes = ["/", "/clientside", "/middlewareside"] is that possible? and change root routes with /clientside when running npm run dev

brianrahmarela
Автор

Very good tutorial, but how to link it with the next-auth i.e. how to get session details in a first place?

traconisek
Автор

And how to change the variable sessionStatus for example after successful login. Because I want to let user use these routes after login.

i_ve_given_up
Автор

Can I use this with redux toolkit and check if isAuth state set to false protect my route else not protect it like I do in react?

MokhtarKhamam