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

КОМЕНТАРІ • 69

  • @ihorploskodnyak1294
    @ihorploskodnyak1294 2 роки тому +6

    You tutorials are amazing. Every time you are making them so easy to understand. Thanks for all your hard work. Bless you

  • @vaaaaaaaaan8678
    @vaaaaaaaaan8678 6 місяців тому

    Thankyou for everything!!, its amazing and you have a very clear explenations. I hope you do a lot more tutorials about nestjs

    • @ansonthedev
      @ansonthedev  6 місяців тому

      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

  • @brangtoggez6363
    @brangtoggez6363 7 місяців тому

    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

    • @ansonthedev
      @ansonthedev  7 місяців тому

      Thank you and I'm glad you found this video helpful!

  • @thePINGUSTAR
    @thePINGUSTAR 5 місяців тому

    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!

    • @ansonthedev
      @ansonthedev  5 місяців тому +1

      Thanks for the suggestion! :)

  • @nelsonjo14
    @nelsonjo14 Місяць тому

    Thanks for the tutorial, very useful, greetings!!!

  • @TheMudioc
    @TheMudioc Рік тому +6

    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...

    • @deadpoolweid
      @deadpoolweid Рік тому

      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.

  • @chillmelon7894
    @chillmelon7894 Рік тому

    Dude this is awesome. Crystal clear!!

  • @zaid4481
    @zaid4481 9 місяців тому

    You tutorials are amazing ,Thanks

  • @potantirittisak8494
    @potantirittisak8494 Місяць тому

    Thank you!

  • @Liam02
    @Liam02 Рік тому +3

    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

  • @viktorbuzanov
    @viktorbuzanov Рік тому +1

    Thanks

  • @user-sz8lo7vu9b
    @user-sz8lo7vu9b 9 місяців тому

    Thanks a lot, it was a really useful lesson)

  • @AbdulRehman-pc2xx
    @AbdulRehman-pc2xx 9 місяців тому

    Simply Amazing Tutorial I must say

  • @amzfree
    @amzfree Рік тому +1

    Such a great tutorial. It really helps me a lot.

  • @volkswagenpassat-w3o
    @volkswagenpassat-w3o 5 місяців тому

    Great video! Many thanks :)

  • @thaingocnguyen1015
    @thaingocnguyen1015 Рік тому +1

    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

  • @homelander973
    @homelander973 Рік тому

    thank you very much, it was pretty useful material^^)

  • @cr7forever7877
    @cr7forever7877 10 місяців тому +1

    what theme are you using?

  • @faberjoo7629
    @faberjoo7629 Рік тому

    Thanks Your course was very useful.
    I have a question, how do I add multiple social logins, including google social logins??

  • @salahadindinsafa7657
    @salahadindinsafa7657 Рік тому

    Thank you sir it was useful !!

  • @s1dev
    @s1dev 9 місяців тому

    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?

  • @izuchukwusamson3150
    @izuchukwusamson3150 Рік тому

    Thank you for this wonderful tutorial.
    It really helped.
    Also, I tried joining your discord server but the link is invalid

  • @sdsim1
    @sdsim1 Рік тому

    Hi, thanks for the video

  • @belkocik
    @belkocik 10 місяців тому

    How to do it with a JWT instead of a session?

  • @NOBODYxx09
    @NOBODYxx09 Рік тому

    should we use token passed authentication or sessions with OAuth2 ?

  • @SocialChain-dn8of
    @SocialChain-dn8of Рік тому

    thank you very match 👍👍👍👍👍👍👍👍

  • @AbdulRehman-pc2xx
    @AbdulRehman-pc2xx 9 місяців тому

    Amazing tutorial @Anson the Developer may I know your vs code theme

    • @ansonthedev
      @ansonthedev  9 місяців тому

      Horizon Theme - marketplace.visualstudio.com/items?itemName=alexandernanberg.horizon-theme-vscode

    • @AbdulRehman-pc2xx
      @AbdulRehman-pc2xx 9 місяців тому

      Thanks brother@@ansonthedev can I have your linkedin please

  • @georgy2763
    @georgy2763 Рік тому

    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

    • @jambojambo1
      @jambojambo1 Рік тому

      same question here, did you find a solution?

  • @s1dev
    @s1dev 10 місяців тому

    will userRepository work the same if I am using something like prisma instead of TypeORM?

    • @ansonthedev
      @ansonthedev  10 місяців тому +1

      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.

  • @theflyingdutchman3942
    @theflyingdutchman3942 Рік тому +1

    What do you mean by updating the user when it is found?

    • @ansonthedev
      @ansonthedev  Рік тому +2

      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.

    • @theflyingdutchman3942
      @theflyingdutchman3942 Рік тому

      @@ansonthedev loud and clear thanks!

  • @Orlan2893
    @Orlan2893 9 місяців тому

    Hello somebody can help me with refreshtoken error

  • @rabbysinjp1841
    @rabbysinjp1841 Рік тому

    Solution please

  • @timofeybabisashvili7077
    @timofeybabisashvili7077 11 місяців тому

    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? :)

  • @AbdulRehman-pc2xx
    @AbdulRehman-pc2xx 9 місяців тому

    @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

    • @ansonthedev
      @ansonthedev  9 місяців тому

      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.

    • @AbdulRehman-pc2xx
      @AbdulRehman-pc2xx 9 місяців тому

      @@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

    • @ansonthedev
      @ansonthedev  8 місяців тому

      The token is for auth, so yes you will

  • @theflyingdutchman3942
    @theflyingdutchman3942 Рік тому

    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!

  • @truongkhanguyen6241
    @truongkhanguyen6241 5 місяців тому

    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

    • @truongkhanguyen6241
      @truongkhanguyen6241 5 місяців тому

      It seem the library not working with nestjs anymore 😢

    • @ansonthedev
      @ansonthedev  5 місяців тому +1

      It's not an issue with the library. You're missing the scope which is required.

    • @truongkhanguyen6241
      @truongkhanguyen6241 5 місяців тому

      ​@@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

  • @SocialChain-dn8of
    @SocialChain-dn8of Рік тому

    best video🤘👍👍👍👍

  • @rabbysinjp1841
    @rabbysinjp1841 Рік тому

    Tool use Google OAuth2

  • @rabbysinjp1841
    @rabbysinjp1841 Рік тому

    Hello sir

  • @rabbysinjp1841
    @rabbysinjp1841 Рік тому

    Please help me

  • @rabbysinjp1841
    @rabbysinjp1841 Рік тому

    My account is hack

  • @AliAliOxenFree
    @AliAliOxenFree Рік тому

    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 },
    });

  • @elcho911
    @elcho911 7 місяців тому

    Thank you!