Authentication in Nest.js: JWT Protected APIs and Refresh Token

Authentication in Nest.js: JWT Protected APIs and Refresh Token

Sakura Dev

1 год назад

27,742 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Ne0nPL
Ne0nPL - 23.11.2023 16:20

`${process.env.jwt_secret}` is incorrect solution because it cause empty string as secret ;)

Ответить
Motiur Rahman
Motiur Rahman - 15.09.2023 21:12

Hello Sir, for /refresh API I can not pass the token via body it's asking for the user name what is the issue. @UseGuards(RefreshJwtAuthGuard)
@Post("/refresh")
async refreshToken(@Request() req: any) {
//console.log(req.user);
return await this.authService.refreshToken(req.user);
}

Ответить
Patty Beaut Code
Patty Beaut Code - 20.08.2023 16:15

I really like how you teach these series ! Please build more authenticate and authorization NestJS app with key cloak 💥💥

Ответить
imthedaniels
imthedaniels - 10.08.2023 00:17

Greetings from Brazil, amazing tutorial, helped me a lot!

Ответить
PhillGames
PhillGames - 20.07.2023 18:58

thnks dude! such a great video! i've learning so much w/ this!. Greetings from Brazil!

Ответить
Rhythm Khandelwal
Rhythm Khandelwal - 16.07.2023 19:06

It would be great if you upload a video on integrating microservice with Nest.js using Kafka. Thanks!

Ответить
Adi Gunawan
Adi Gunawan - 16.07.2023 15:46

I saw refresh token and access token have same payload, I think refresh token can be access main jwt authguard too? referesh token was too waste. i've googling referesh token concept but nothing. you can create token and refresh token with same payload but the secret key must be different

Ответить
Grégory Alvim
Grégory Alvim - 06.07.2023 01:37

Thank you for this video! It was of great help for me.

Ответить
Jeetu Dewangan
Jeetu Dewangan - 04.07.2023 14:34

where and how we can store logged in user imformation like email, user_id, and role for further uses

Ответить
Hadi Rahmani
Hadi Rahmani - 02.07.2023 22:20

You created JwtStrategy class and defined that in auth provider and you don't used from that. why?

Ответить
Alex Coronell
Alex Coronell - 08.06.2023 19:09

Thank you very much!!!

Ответить
Luke Kennedy
Luke Kennedy - 08.06.2023 11:27

Thank you for this! I m looking forward to the TypeORM tutorials for NestJS. :D

Ответить
cuberos
cuberos - 07.06.2023 19:03

Congratulations Excellent Tutorial Thanks Sakura

Ответить
Yasser Youssef
Yasser Youssef - 05.06.2023 20:01

I am stuck here. My refresh token is always coming without the payload encoded. I noticed that the the user passed to the refreshToken function seems to be empty. But when I use console.log(user), I can see the data. But when I try to use the data to populate the payload, the payload is always empty as if it cannot read any of the user properties. What is going on? Please note that I also checked the newly generated AccessToken that you produced, and it seems it is having the same issue

Ответить
EJ-Developer
EJ-Developer - 05.06.2023 12:36

good

Ответить
leocrawf stewart
leocrawf stewart - 22.05.2023 22:30

Could you complete this by adding simple roles?

Ответить
Gia Khánh Hồ
Gia Khánh Hồ - 15.05.2023 11:36

where does passport compare that payload is correct?, i mean if you decode jwt from bearer header, you should see if payload is correct.

Ответить
zagrebalski
zagrebalski - 25.04.2023 22:43

Everyone writes guides about jwt token so cool, but no one wrote down what to do if an attacker stole a refreshToken

Ответить
Furkan ÇAKICI
Furkan ÇAKICI - 20.04.2023 19:45

Can you prepare a dockerize tutorial that simulates dev and prod environment? Thames 👌

Ответить