NestJS & Google OAuth2 with Passport
Вставка
- Опубліковано 25 сер 2024
- Code: github.com/stu...
Support the Channel:
Become a Member: www.youtube.co...
Become a Patreon: / stuyy
Buy me a Coffee: ko-fi.com/anson
Donate on Streamlabs: streamlabs.com...
Donate on PayPal: paypal.me/anso...
Connect with me:
Twitter: / ansonthedev
Discord: / discord
GitHub: github.com/stuyy
Twitch: / stuy
You tutorials are amazing. Every time you are making them so easy to understand. Thanks for all your hard work. Bless you
Thankyou for everything!!, its amazing and you have a very clear explenations. I hope you do a lot more tutorials about nestjs
Thank you. I have a playlist with a lot of videos on Nest JS. Feel free to check it out here: ua-cam.com/video/nH9E25nkk3I/v-deo.html
This video is so good, with the code repository as well. You are a legend man.
Passport in my opinion is a really library to learn since their documentations aren't that great. But your video clarify everything for me. again Thank you
Thank you and I'm glad you found this video helpful!
great tutorial, well explained - working great! I would love to see how I would go from here and authenticate a user in the frontend. And how to refresh tokens. Keep up the great work!
Thanks for the suggestion! :)
Thanks for the tutorial, very useful, greetings!!!
Hello ! Thank you for the great insights, it helped me a lot, however I'm wondering what are accessToken and refreshToken for ? We're getting them but not doing anything with them...
On the next user login, you need to use them to login user on google automatically, and retrieve his freshly profile data which could be edited.
Dude this is awesome. Crystal clear!!
You tutorials are amazing ,Thanks
Thank you! :)
Thank you!
hello you tutorials are great. When logging google successfully, I want to redirect and return data for Frontend, I don't know you have any way, please help me ! Thanks
Thanks
Thanks a lot, it was a really useful lesson)
Спасибо
Simply Amazing Tutorial I must say
Thank you!
Such a great tutorial. It really helps me a lot.
Great video! Many thanks :)
Hi thank you for amazing video. In my case I want to use JWT instead of session with this strategy, is this possible to do that? I have done some research but it's seem impossible
thank you very much, it was pretty useful material^^)
what theme are you using?
Thanks Your course was very useful.
I have a question, how do I add multiple social logins, including google social logins??
Thank you sir it was useful !!
I am having a hard time implementing the frontend for this code, in react as the react server runs in different port, can you help me out?
Thank you for this wonderful tutorial.
It really helped.
Also, I tried joining your discord server but the link is invalid
Hi, thanks for the video
How to do it with a JWT instead of a session?
should we use token passed authentication or sessions with OAuth2 ?
thank you very match 👍👍👍👍👍👍👍👍
Amazing tutorial @Anson the Developer may I know your vs code theme
Horizon Theme - marketplace.visualstudio.com/items?itemName=alexandernanberg.horizon-theme-vscode
Thanks brother@@ansonthedev can I have your linkedin please
Hi, can you please help me?) how to test this flow in postman? Redirect doesn’t work for me in postman, so I can’t call my endpoints with Google oauth from there. It would be good if you could explain it)thanks
same question here, did you find a solution?
will userRepository work the same if I am using something like prisma instead of TypeORM?
Well, out of the box, no, but the idea of a Repository Pattern is not specific to a package or ORM. I would suggest looking into it on Google and seeing if you can find examples or research articles, because it's a lot to talk about in a youtube comment section.
What do you mean by updating the user when it is found?
When you find the user, the user saved in the DB might have stale data (profile pic, display name) because they could be changed by the user through Google. So if you want to reflect those changes you need to update the user.
@@ansonthedev loud and clear thanks!
Hello somebody can help me with refreshtoken error
Solution please
Hey! Great tutorial. In the end of this video you promise to show to make it with other social media, but i can find any video with the same code. Can anyone send me a link, please? :)
@anson I have a quick question I am uisng mongodb with mongoose, when I dont find the user i need to register it now I dont have the password of user from google details .
How may i store the user to my database
1 How to create jwt token eiter I use access token provided by the oAuth but if i use it it will not pass my jwt strategy
i have little confusion here Please guide me thanks in advance
Look at 1:07:18, inside the auth.service.ts file, specifically the validateUser method. This method is called from the GoogleStrategy.ts file's validate method. If the user is not found, it will create one and return it. You don't need to worry about the password.
@@ansonthedevbut what about the token do i need to create new token with jwt or use the google provided accesstoken
and in my user model I made password is required
The token is for auth, so yes you will
Do you nee to setup a specific account to use as a test account for google cloud console? I cant seems to get an access token....
The user is being added to te database and I successfully retrieve the data form the database from the app, thx in advance!
.
You can just use an email and add it as a test user.
i facing an issue:
Access blocked: Authorization Error
Missing required parameter: scope Learn more about this error
If you are a developer of TECHBLOG COMMUNITY, see error details.
Error 400: invalid_request
I have added email tests. I tried searching but there was no such error
It seem the library not working with nestjs anymore 😢
It's not an issue with the library. You're missing the scope which is required.
@@ansonthedev you are right, just missing scope. But it must be declared inside the guard file instead of strategy file. Most tutorials do not mention this issue
best video🤘👍👍👍👍
Tool use Google OAuth2
Hello sir
Please help me
My account is hack
this is yet another excellent tutorial. by far the best teacher on YT. thanks a bunch for these vids buddy, never stop!
also, at minute 54:00 the findOne method works like this:
const user = await this.userRepository.findOne({
where: { email: details.email },
});
Thank you!