The BEST OAuth Golang Tutorial for Authentication | Sign In With Google

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ธ.ค. 2024

ความคิดเห็น • 115

  • @MelkeyDev
    @MelkeyDev  ปีที่แล้ว +32

    I hope you enjoy this longer tutorial style video!
    Let me know if you enjoy this style of content - been experimenting a lot with different types of videos!
    Please make sure to comment + like - the algo loves it

    • @heliorosa8148
      @heliorosa8148 ปีที่แล้ว +1

      blurs email, leaks email in the console output. lol

    • @jaymartinez311
      @jaymartinez311 ปีที่แล้ว

      I prefer the longer videos. They provide more context and show me how you think as a developer with golang.

    • @amardeepsingh1168
      @amardeepsingh1168 ปีที่แล้ว +1

      Can you please extend this video how auth can utilised for auhtnicating other api ?

    • @jaymartinez311
      @jaymartinez311 ปีที่แล้ว

      @@amardeepsingh1168 I asked for a full series on this actually 😃 @MelkeyDev hey man i see opportunity. 🤷🏾‍♂️ Maybe even a paid course some day. A lot of us are a bit off in putting all these pieces together and sometimes the examples are to complicated, require to clone and work on a project we didn’t create ourselves or minimal with the, oh you can figure it out 😂🫡. Just saying.

    • @BryceChudomelka
      @BryceChudomelka ปีที่แล้ว

      The state parameter passed from login to callback differs, thus is not secure from CRFS.

  • @shintaii84
    @shintaii84 ปีที่แล้ว +53

    “I do not want you to show my email” a few second later the email is printed out in the console.

  • @jaymartinez311
    @jaymartinez311 ปีที่แล้ว +22

    Maybe a whole backend tutorial series to combine it all and we all become golang ninjas 😅

  • @AzzynTeam
    @AzzynTeam 11 หลายเดือนก่อน +7

    A complete implementation of authentication with cookies, permissions, middleware using this library would be great help. Thanks for share your knolage ^^

    • @MelkeyDev
      @MelkeyDev  11 หลายเดือนก่อน +1

      I really appreciate this comment

    • @banafish
      @banafish 10 หลายเดือนก่อน

      i agree, even just authorization on routes would be really great

  • @brotherthegrest
    @brotherthegrest ปีที่แล้ว +7

    The one video i needed for my project

  • @emil_l889
    @emil_l889 ปีที่แล้ว +1

    Let’s goooo Go auth video dropped, putting a suit on one sec!!!

  • @hrqmonteiro
    @hrqmonteiro ปีที่แล้ว +7

    Would be nice to see beyond from that, like storing the User in your "user" table in a database. This way you can handle a signup and signin for the user.
    Couldn't find any example of that online. In other languages is plenty of it, like Node with Prisma and Nextauth for Oauth.

  • @nnamdi6739
    @nnamdi6739 9 หลายเดือนก่อน +1

    How about performance consederations? if I did not need more than 3 oauth services, using the built in go oauth package may be a better choice, what's your take, but at the end it all make sense what to choose

  • @banafish
    @banafish 10 หลายเดือนก่อน +4

    I think there are too many jumpy cuts. I followed this very closely while looking at the repo and the video leaves out the "beginAuthProviderCallback" function, without which this won't work. But most importantly I don't understand the use of context here and would have liked more details about that. On the upside it made me curious so I looked it up.

    • @MelkeyDev
      @MelkeyDev  10 หลายเดือนก่อน +1

      Appreciate the feedback banafish

  • @martingallauner
    @martingallauner 7 หลายเดือนก่อน +1

    Awesome video! Exactly what I was looking for.
    Fun fact: I watch your video on 0.8x speed

  • @nanakwesiaikins9026
    @nanakwesiaikins9026 ปีที่แล้ว +2

    I have a golang api only project. How can I use it with a mobile app? Since there is no redirect to the mobile application

  • @artemcodes
    @artemcodes 2 หลายเดือนก่อน

    As usual, amazing work!

    • @MelkeyDev
      @MelkeyDev  2 หลายเดือนก่อน

      Thank you! Cheers!

  • @meirionlayton6077
    @meirionlayton6077 ปีที่แล้ว +1

    Great video, has helped my out with implementing this exact thing in my project! I think having a way to view the final code for at least the implementation of the goth authorization functions in the backend could be helpful. You mentioned copy and pasting 2 of the 3 functions from goth accross to save video time, but being able to see the end result of that and how it all should fit together could help make it clearer for people. Very helpful video regardless, thanks.

    • @MelkeyDev
      @MelkeyDev  ปีที่แล้ว

      That's a great idea!

  • @esra_erimez
    @esra_erimez 4 หลายเดือนก่อน +1

    A small creature is sitting under your nose. I know you can't see it so I thought I'd point it out for you. Great video by the way, I've been binge watching your channel.

    • @MelkeyDev
      @MelkeyDev  4 หลายเดือนก่อน +1

      Hahah thank you
      The creature is gone in the newer videos :)

  • @the_doctor_cat
    @the_doctor_cat ปีที่แล้ว

    I am new to golang and I was searching for some times now, thank you boss

  • @Antonio-yy2ec
    @Antonio-yy2ec 9 หลายเดือนก่อน

    Pure gold! Thanks for sharing. It was just I needed

  • @SuperOmercohen
    @SuperOmercohen ปีที่แล้ว +2

    I think you need to first implement the integration with google oauth yourself to understand how things work and only then go to libraries

  • @joseph0x45
    @joseph0x45 ปีที่แล้ว +2

    noice, I struggled a little bit to implement github oauth in my Golang x Sveltekit app recently. Will probably rewrite it using goth cos it looks so much cleaner than my implementation. That editing tho! 🙌

    • @CuongNguyen-gu9fl
      @CuongNguyen-gu9fl 9 หลายเดือนก่อน +1

      Yo can I have your repo link?

    • @joseph0x45
      @joseph0x45 9 หลายเดือนก่อน

      @@CuongNguyen-gu9flhey, sorry but I ultimately ditched the github oauth all together xD not sure if you still want the repo link after hearing that

  • @CuongNguyen-gu9fl
    @CuongNguyen-gu9fl 9 หลายเดือนก่อน +1

    I can't get redirected URI right for some reason.

    • @MelkeyDev
      @MelkeyDev  9 หลายเดือนก่อน

      What is the issue?

    • @CuongNguyen-gu9fl
      @CuongNguyen-gu9fl 9 หลายเดือนก่อน

      @@MelkeyDevI was silly, didn't put the correct redirect URL.
      Thanks for your video, but another video using it with an endpoint would be nice.

  • @ChristopherRyan-i9p
    @ChristopherRyan-i9p ปีที่แล้ว +3

    Nice one definitely would like to see more of this type of stuff from you, great tutorial

    • @MelkeyDev
      @MelkeyDev  ปีที่แล้ว +1

      Thanks, will do!

  • @SuperTieX
    @SuperTieX 10 หลายเดือนก่อน

    Any idea how to manage this from a mobile app using dart or react native instead of the web interface?

  • @sevafadeev2257
    @sevafadeev2257 2 หลายเดือนก่อน

    Can you please share source code of that example with us?
    I have been trying to implement google oauth for days, but I’m facing cors error from google any ways.
    I appreciate any kind of help

  • @ashraffayad
    @ashraffayad 11 หลายเดือนก่อน

    Thank you very much for this clear and detailed tutorial. It was a big help.

  • @rudy-anconi
    @rudy-anconi 6 หลายเดือนก่อน +2

    You can call it a complete tutorial when you store the user on the database, setup the cookies and create a profile page.

    • @MelkeyDev
      @MelkeyDev  6 หลายเดือนก่อน

      I can add it to a future tutorial if you want, I didnt want to overload with so much information into one video.

  • @lcarv20
    @lcarv20 8 หลายเดือนก่อน

    As you said at the beginning, I have been looking for a video like this, great video!! Ps: How does teej feels about you using vsode?

  • @RubberGopher
    @RubberGopher 4 หลายเดือนก่อน +1

    You should've used `r.Context()` when you use `r.WithContext` instead of `context.Background()`. If the client closes the connection, you do not want to waste time on the auth flow. Take advantage of the context that comes with the request.

  • @moonlags1605
    @moonlags1605 ปีที่แล้ว +2

    how can frontend know if user is authenticated??

    • @MelkeyDev
      @MelkeyDev  ปีที่แล้ว

      You would need to do something with a session token

    • @BryceChudomelka
      @BryceChudomelka ปีที่แล้ว

      You could also create your own JWT from the user email and user ID for the session. I just used the OAuth for fast sign-up/sign-in.

  • @MarkMcKavanagh
    @MarkMcKavanagh 10 หลายเดือนก่อน +1

    Helpful vid! However wondering what the purpose is of the cookie store? Does this send a cookie back to client?

    • @Rahman-xm7zm
      @Rahman-xm7zm 10 หลายเดือนก่อน +1

      The cookie is for storing acsess token on the client. To make your app more secure, the access token should not be passed directly to the user. Instead, create a session token that is sent to the user as a cookie. The app will maintain a mapping of the session tokens to access tokens on the server side (most likely a database).

  • @oscarmendez9079
    @oscarmendez9079 ปีที่แล้ว

    Liked and subscribed - thanks for the great content my dude

  • @jorgesa4244
    @jorgesa4244 10 หลายเดือนก่อน +1

    What console do you use? seems prett6 different from wsl

    • @MelkeyDev
      @MelkeyDev  10 หลายเดือนก่อน

      Just the standard console from Ubuntu lol

  • @charleschen4093
    @charleschen4093 ปีที่แล้ว

    Thanks man! love this content

  • @BryceChudomelka
    @BryceChudomelka 11 หลายเดือนก่อน +1

    Your code does not work. :)
    After the callback, check state from the url query and then check your state, they are different. In other words, not secure to CRFS and thus invalid.

    • @MelkeyDev
      @MelkeyDev  11 หลายเดือนก่อน +1

      My code works :)

  • @khoirularifin3648
    @khoirularifin3648 7 หลายเดือนก่อน +1

    How to logout and login with another account?

    • @MelkeyDev
      @MelkeyDev  7 หลายเดือนก่อน

      You might need to clear cache and try again to get to the Google OAuth home screen

  • @ezrahel
    @ezrahel 3 หลายเดือนก่อน

    Melkey, it's not clear... You keep skipping some process and I end up getting "you must select a provider" on my screen

    • @abhishekshukla7803
      @abhishekshukla7803 3 หลายเดือนก่อน

      I think you need to pass the provider in the route where you call gothic.BeginAuthHandler()
      provider := chi.URLParam(r, "provider")
      r = r.WithContext(context.WithValue(context.Background(), "provider", provider))

  • @vaayuo
    @vaayuo ปีที่แล้ว

    Yess omg
    I got fed up with searching for an 3rd party auth example for go lang and started learning jwts and shizz

  • @anthonygravier2055
    @anthonygravier2055 4 หลายเดือนก่อน

    Hey Melkey, I am having trouble, where I am encountering a "could not find a matching session for this request". Do you know what my issue could be?

    • @anthonygravier2055
      @anthonygravier2055 4 หลายเดือนก่อน

      I do want to mention that I am using gorilla mux as my router as well

    • @NNeshz
      @NNeshz 3 หลายเดือนก่อน

      Do you fix it? Can you help me please?

  • @JensUwe-24
    @JensUwe-24 ปีที่แล้ว

    nice stuff really like your channel :)

  • @theangelofspace155
    @theangelofspace155 ปีที่แล้ว +10

    Maybe not editing that much. Show the whole setup. Maybe redo this making a vite react app (todo) with go as the backend, chi as api server, postgres for the database (show how to connect to the databased) and auth (can use goauth but instead just printing the user, actually use it and show the worflow with the database). So a full stack tutorial. We will watch even if it is a couple hours. If it goes above an hours break it doen on parts like, "setting the backend" , "setting the frontend", "adding posgres driver", etc.

  • @jaymartinez311
    @jaymartinez311 6 หลายเดือนก่อน +1

    the maintainer has a medium blog stating he’s not maintaining the package anymore and is looking for someone to take it over. Just so everybody knows

    • @MelkeyDev
      @MelkeyDev  6 หลายเดือนก่อน

      oh what? do you have a link?

    • @jaymartinez311
      @jaymartinez311 6 หลายเดือนก่อน

      @@MelkeyDev hold on i’ll get it but you might have to have a medium premium account though.

  • @manee427
    @manee427 6 หลายเดือนก่อน +1

    Awsome can you provide the repo for your code also ?

    • @MelkeyDev
      @MelkeyDev  6 หลายเดือนก่อน +1

      I can make a new one!

    • @manee427
      @manee427 6 หลายเดือนก่อน

      @@MelkeyDev would be a good idea to ake a new more in depth video about it

  • @dikan34
    @dikan34 ปีที่แล้ว

    This is fire! We need more content like this

  • @camilo5821
    @camilo5821 ปีที่แล้ว +1

    hi mate, i really enjoy your content can you do more like this?? , cheers from Chile 🇨🇱

  • @Cruzylife
    @Cruzylife 8 หลายเดือนก่อน

    where the github repo

  • @valentineejk
    @valentineejk ปีที่แล้ว

    can you please do one for apple

  • @andybright3809
    @andybright3809 ปีที่แล้ว

    Timely for me, and appreciated. Thanks.

  • @iCrimzon
    @iCrimzon ปีที่แล้ว

    Youre like, 1 of 4 Go users in the whole world, should def make a whole Go backend series , oauth, api security, etc, backend stuff we should know

  • @fatalsg92
    @fatalsg92 10 หลายเดือนก่อน +1

    More Tutorials please!!!

    • @MelkeyDev
      @MelkeyDev  10 หลายเดือนก่อน

      Okay - what do you want to see?

    • @fatalsg92
      @fatalsg92 10 หลายเดือนก่อน

      @@MelkeyDev videos like this one. Go tutorials of things you think are interesting. Cheers!

  • @jfkongphop
    @jfkongphop ปีที่แล้ว +1

    Can you give this github repo

    • @MelkeyDev
      @MelkeyDev  ปีที่แล้ว

      For this project? or go auth?

    • @mirandagonebald
      @mirandagonebald ปีที่แล้ว

      This repository, it would be greatly appretiated@@MelkeyDev

    • @andriiboiadzhi
      @andriiboiadzhi 4 หลายเดือนก่อน

      @@MelkeyDev For this project. Some parts are missing

  • @woodmanmade
    @woodmanmade ปีที่แล้ว +2

    no htmx frontend!!?? Melkey, big disappoint

  • @celestinediask
    @celestinediask 8 หลายเดือนก่อน +31

    very bad tutorial you are skipping important parts of the video like setting up client id and secret key in google console and also you are skipping without even explaining things well. Now I have to watch another video to finish this. So here is my dislike. Sorry for being rude.

    • @sirichan3131
      @sirichan3131 7 หลายเดือนก่อน +7

      i think same

    • @SirJagerYT
      @SirJagerYT 5 หลายเดือนก่อน +3

      yup

    • @anthonygravier2055
      @anthonygravier2055 4 หลายเดือนก่อน

      Love you melkey and your vid’s but I have to agree for once

    • @dotarjun
      @dotarjun 4 หลายเดือนก่อน

      get gud kid

    • @umardev500
      @umardev500 หลายเดือนก่อน

      This garbage channel

  • @jesulobajohn8468
    @jesulobajohn8468 7 หลายเดือนก่อน

    Goth has no documentation bro

    • @MelkeyDev
      @MelkeyDev  7 หลายเดือนก่อน

      I looked at it?

  • @iliassglitch
    @iliassglitch 4 หลายเดือนก่อน +2

    Incomplete useless video.
    1. You define getAuthCallbakcFunction to handle the route "/auth/{provider/callback" which you never use
    2. You never show the actual auth route /auth/{provider} which you route to in your react app's handleLogin function
    3. You just print the user in your getAuthCallbackFunction which you never use

    • @MelkeyDev
      @MelkeyDev  4 หลายเดือนก่อน

      make a better one then

    • @Lohan_Guedes
      @Lohan_Guedes 4 หลายเดือนก่อน

      @@MelkeyDev bro you're menace lol Love you

  • @stratavr
    @stratavr 9 หลายเดือนก่อน

    you don't need to blast your face on my screen every 10 seconds. jesus christ

    • @MelkeyDev
      @MelkeyDev  9 หลายเดือนก่อน +1

      what the fuck are you talking about

  • @kenzo3477
    @kenzo3477 ปีที่แล้ว

    😂 I still prefer to go with rust

  • @FrankiDaTank
    @FrankiDaTank ปีที่แล้ว

    common W!

  • @ysomad
    @ysomad ปีที่แล้ว

    Great vid! Just found out for my projects ory kratos - perfect solution, oss, selfhosted identity service with social logins etc. Very easy to setup almost all oauth2/oidc providers to sign in with. Highly recommend!