How to Log Out From Node JS Server with JsonWebToken

preview_player
Показать описание
In this video series we are creating a full stack authentication app using node js and react native. We are using JsonWebToken authenticate our user inside the node js server.

JsonWebToken is awesome when it comes to authorize user, we can sign the token with some secret on our backend server. But JsonWebToken is little bit hard when it comes to log out from our backend server.

So, in this video we will see how we can log out from our backend server (node server) with JsonWebToken.

Buy me a coffee

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

Bhut ache, par bich me jo code ya db dikha rhe the font bhut chota tha, agar font ka size acha hoota to fir kisi or ki video dekhne ki jarurat hi nhi parti

rashdeepsingh
Автор

Thank you for this fantastic video, your channel is hidden gem, keep up the good work.

overrevvv
Автор

thanks Niraj. What you are contributing is very useful for me

ferbass
Автор

me too thanks Niraj. What you are contributing is very useful for me

kimou
Автор

Hi Niraj! Why did you write that peace of code when user logs out? Isn't enough just writing like this: User.findByIdAndUpdate(user_id, {tokens: []}) ?

annecbranco
Автор

Good video, but asking me to subscribe 5 times is very annoying. A good video and asking a couple times is sufficient.

MinisterGold
Автор

hii niraj, i have a big problem dealing with jwt.
so i was sending jwt in cookies from my backend
and accessing those cookies using withCredentials:true using axios
but i cant remove cookies from my backend in my logout api.
in my inspection mode i see that cookie persist in my browser and after a refresh it just log back in the user.

if i am going to store the jwt in my db then how m gonna access it on my client side.

and this logout api not working in production mode. i deployed my application on vercel but in localhost it works really fine.

it would be great if u can help.

voidonz
Автор

using this approach can we proceeding with multiple devices ? because we are verify the token from our database and every every-time when we are sign in we updating our token

umersaleem