Next.js 13 jwt authentication protected routes httpOnly cookie with App Directory

preview_player
Показать описание
You'll learn how to implement the authentication flow with JWT and httpOnly cookie. You will also learn how to protect routes and get user info by verifying the jwt token.

Рекомендации по теме
Комментарии
Автор

Exaclty what I needed to learn, all in one video. Thank you!

verdaderoken
Автор

Bro just saved me from getting frustrated.

saifmohammad
Автор

My man, thank you very much for this perfect tutorial, I was stuck with the part of getting back the cookie but with this "serialize cookie" all of the errors disappeared .
Big hug from Argentina!

ivanerlich
Автор

I'm trying to understand the NextResponse and cookies and api's from long time for authentication setup. this clarified my doubt. Thank you so much for sharing 😊

dudduvenkatesh
Автор

Bro... This tutorial is fantastic, straight to the point and very clear, thanks!.

danielalejandrogonzalezmor
Автор

As a beginner in nextjs I learned a lot more from this video, than any other one I've watched. Thank you!

leventegaborlevai
Автор

Great! You NEED to add in Refresh tokens next :)

stevemcqueen
Автор

thanks! that’s a lot of help for my school project 👍

kiraizumi
Автор

that's what i was looking for thanks so much keep it up

dexcoder
Автор

Jesus Christ man. You are amazing <3 Please keep making videos. The dev world needs you.

pegaessefeedback
Автор

This is exactly what I was looking for, could you make a video where we fetch the data and auth from Strapi? Thanks and congrats for your content. Really useful.

motivatedlifex
Автор

Thank you so much bhai 🤗; This is what I actually want to implement

FahimRayhan
Автор

wow this was a nice video
I liked how you used the dashboard layout file as middleware, pretty cool

mshubitidze
Автор

Excellent, worked first time ... thank you, I've been pulling my hair out all day

MadRad
Автор

so inside of api/auth/login/route.ts where you had the if statement checking to make sure it was admin admin, that is where you would make a POST request to the database you are using? and then pass through the body to it as the values?

jacobmacfarlane
Автор

Great tutorial thank you!
I just have one question, how would you send the cookies from server side components?
What occurred tp me is each time I make the request from the server, I get the cookie manually and add it to the 'Cookie' header on each request, is there a better way to do it? ( I saved the cookie using cookies().set(...) from 'next/headers' after my login request)
I would appreciate your input, thank you :)

miguelcardenas
Автор

Good video! but I have a doubt :( According to what I have read httponly cookies are the most secure way to do user authentication, can you explain me what is the reason in the context of the video implementation please, this topic has me a bit confused.

gfaso
Автор

Why do we need an api route to check the cookies? Can't we just check it in an useEffect on client side?

motivatedlifex
Автор

What if the backend is from outside source API? And we can't verify the jwt from our nextjs app because we dont know the secret?

erkikadhafi
Автор

How can the client pass a token in the cookie if it's http only ? I thought this prevents the client JavaScript from being able to see and this pass the access tokens to the API calls ?

daviddoyle