JWT Authentication in Go (Gin/Gorm)

Поделиться
HTML-код
  • Опубликовано: 22 янв 2025

Комментарии • 155

  • @YidiEnterprises
    @YidiEnterprises 6 месяцев назад +21

    I'm an experienced dev. New to Go. I can't stand most coding tutorial. I feel like most youtubers make the content seem inaccessible, like you need their help to learn it and there is no better way and then they pass themselves off as experts on it all. I recently discovered your channel while exploring go concepts and you are the exception. You make it very clear where everyone can go to learn materials on their own if they want to branch off from your tutorial. You show the documentation and your process of learning in a way that lets other people learn how to learn rather than rely on you covering exactly what they need. You are not afraid to demonstrate concepts in a way that may make people think you are learning it for the first time and I love that

  • @rezaverse
    @rezaverse 5 месяцев назад +7

    aweome. thank you. PS: that typo in SECRET in the ENV was killing me the whole time :))))

  • @fabtjar
    @fabtjar 2 года назад +9

    I like how you are going through all the same setup like you did with your other Go video. Good way for me to remember the steps. I hate tutorials when they want you to watch their 20 setup videos first. Cheers.

  • @terrytas13
    @terrytas13 2 года назад +18

    Your videos are awesome! Straight forward and super helpful. Keep it up.

  • @ahamedlincon4980
    @ahamedlincon4980 7 месяцев назад +2

    I prefer more straightforward, clean and structured videos like these.. great work man! Just subbed! 👾

  • @alexanderulyev4651
    @alexanderulyev4651 20 дней назад

    This is a very clear yet simple guide, I enjoyed it. It really puts me off when a developer learns the topic of his guide real time. In this video the author is well prepared. Thank you a lot!

  • @toheebojuolape3736
    @toheebojuolape3736 Год назад +6

    Amazing tutorial. Love the way you arrange your files and structure your code. Neat!

  • @lph189
    @lph189 4 месяца назад

    Dude, your a life saver. Love how you explain the code clear without any part of the video. Thankyou.

  • @Dzikrullah_999
    @Dzikrullah_999 Год назад +4

    Clear, concise and straightforward. Thanks man!

  • @lloydChristmas-j6n
    @lloydChristmas-j6n 3 месяца назад

    Great content, appreciate you putting it out there. As a new’ish developer, it would be really cool to see someone put out how they determine what external packages or dependencies to use. It’s easy for someone like me to find a tutorial video like this, follow along and get _something_ that works. I think there would be value in seeing the behind the scenes, if you will, thought process behind design and determining factors of what goes into building the project. Maybe I’m wrong, but that’s the real magic.

  • @nasxmo
    @nasxmo 2 года назад +2

    Your videos on Go really good and clean. Keep creating more videos on Go!

  • @moslemghalandary4700
    @moslemghalandary4700 Год назад

    Oh my God i got to say it was my first time that i comment on a video if you are smart this video is yours it was great and i learned to much thank you man ,i really owe you

  • @QuangMinh-gm3xb
    @QuangMinh-gm3xb Год назад +1

    your middleware usage is much more clean readable than others imo, thank you

  • @the0nerens
    @the0nerens Год назад

    Nice video, really great for an developer starting out with go backend-services! Great you also covered other basic topics next to just JWT!

  • @RossWasTaken
    @RossWasTaken Год назад +1

    I never comment on coding videos but the 'creating a CRUD API' video and this one are both godsends, rare to have everything I needed so efficiently packed together, made my life really easy. it also isn't rocket science for us to branch off from the video since everything is done the way it is in the docs. Criminally underrated channel.

  • @Tobsson
    @Tobsson 11 месяцев назад

    That was quick and neat. Didn't manage to get the daemon running for some reason (couldn't install it correctly. my dist just yelled "NO!" without any reason) but just followed it step by step and got some grasp around it. All I need to do now is build a frontend to use it with hah!

  • @MinecrftGaming
    @MinecrftGaming 6 месяцев назад

    absolutely brilliant tutorial. easy to follow and understand. dont usually comment but thank you so much for this!

  • @HeronHurpia
    @HeronHurpia 6 месяцев назад

    Really useful this video, I've seen some but this one is the best, no doubt! Congratulations!

  • @hwp438
    @hwp438 2 года назад +2

    Loved the way you are explaining things 🤟 Thankyou

  • @freivincampbell
    @freivincampbell 10 месяцев назад

    More than excellent simple to understand, good explained every step

  • @IAmLorenzoF
    @IAmLorenzoF Месяц назад

    Great video! You explain things well therefore I am subscribed and liked the video, although I'd suggest you spent a few more minutes in future videos like this to explain the lines of code, and the functionalities of certain Gin, GORM and JWT features required to achieve the outcome desired. At some point it fells like a bit of pushing through the building process without expanding on core concepts.

  • @FullStackJack
    @FullStackJack Год назад

    Great Tutorial! I understand how difficult it is to make something that looks so smooth and effortless. Thank you! 😃 I find Go attractive, but have never dived in deep. This tutorial makes me want to.

  • @AsenovMiroslav
    @AsenovMiroslav Год назад

    Thank you for the video! It was so helpful for me to find out how to do things in the Go way.

  • @paracha3
    @paracha3 Месяц назад +1

    Should the middleware be querying the database for user when we know if the token was valid, the "sub" is our userId. I feel like query DB in middleware would be too much querying the db. Thoughts?

  • @mufinagamer
    @mufinagamer Год назад

    great tutorials man!! a need to more tutorials with this!!

  • @eldorbeknormatov8773
    @eldorbeknormatov8773 11 месяцев назад

    Excellent simple to understand, good explained every step

  • @joeywong2452
    @joeywong2452 10 месяцев назад

    Very good video with clear explanation! Thank you!

  • @SMJ-Majidi
    @SMJ-Majidi 2 года назад

    its amazing bro literally tons of information in "1" video.

  • @salvinus17
    @salvinus17 Год назад

    thank you for this tutorial Robby, i really appreciate this. Simple and easy to understand

  • @EnTransic
    @EnTransic 2 года назад

    you made it look sooo easy. thanks! this saved me hours of googling ..

  • @igorluizdesousasantos4965
    @igorluizdesousasantos4965 9 месяцев назад

    Awesome video. You are helping a lot. Thanks!

  • @sourovahmad3555
    @sourovahmad3555 2 года назад

    directly to the point. that's really awesome dude. keep it up

  • @who_fkn_cares
    @who_fkn_cares 9 месяцев назад +1

    is there a reason why you're not creating the jwt and storing it in a cookie for the signup handler? What are we doing for session management for first time users?

  • @vladasolovei6169
    @vladasolovei6169 10 месяцев назад

    What a great content, thank you, Robby!

  • @AyushSisodia-m3i
    @AyushSisodia-m3i 7 месяцев назад +3

    Could you please share the GitHub repository for this code.

  • @iqbalalfiansyah5581
    @iqbalalfiansyah5581 7 месяцев назад

    Amazing tutorial , it so simple and easy to understand it thank you so much

  • @3damina911
    @3damina911 2 года назад

    Thanks for video, very easy and helpful to understand the basics!

  • @den_agung
    @den_agung Год назад

    super clear tutorial than the others, thankyou!

  • @hilmialmuhtade8523
    @hilmialmuhtade8523 Год назад

    Thank you, sir! so clear and easy to understand. Great

  • @anuj7286
    @anuj7286 Год назад

    Thank you for sharing such a great topic!

  • @dekooks1543
    @dekooks1543 2 года назад

    this was just brilliant from start to finish !!!

  • @Prakyy
    @Prakyy 4 месяца назад

    Thanks, just made my first backend system.

  • @raunakagarwal6077
    @raunakagarwal6077 3 месяца назад

    Super brilliant video for extreme beginner like me

  • @PezhvakIMV
    @PezhvakIMV 6 месяцев назад

    Just what i was looking for, thank you

  • @phongbui3076
    @phongbui3076 11 месяцев назад

    So wonderful!!! This video is very helpful

  • @yjx-m7k
    @yjx-m7k Год назад

    Thank you for the video. It was very useful to me

  • @georgejoseph2601
    @georgejoseph2601 Год назад +1

    How did the error go away? I thought the error was because of how he misspelled SECRET in the .env file

  • @JhonatanMorais
    @JhonatanMorais Год назад

    HEy one question about security. You are returning the password as part of response (models.user, see 00:35:35). of course this is an example BUT It could easily happen in a real world situation. What is the best practice to avoid this in go/GORM? Should we move the pass-hash to another table? or there is some specific config to tell fiber/GORM that passwordfield is a sensitive field? or instead of use the find-gorn method we create a query with specific fields?

    • @longdashes
      @longdashes Год назад

      You could just remove the field, before returning the User JSON.

    • @ramadhanngallen9217
      @ramadhanngallen9217 Год назад +1

      On your struct exclude it to be exposed like `type User struct {
      Email string `json:"email"`
      Password string `json:"-"`
      ....
      }`
      The - will exclude it to be exposed

    • @rainfog_mzb
      @rainfog_mzb Год назад +1

      @@ramadhanngallen9217 Thanks for your tips. I have some trouble about it and then the problem is solved

    • @ramadhanngallen9217
      @ramadhanngallen9217 Год назад

      @@rainfog_mzbYou're welcome

  • @L0wPressure
    @L0wPressure Год назад

    Thanks, practical tutorials are awesome :)

  • @fatcamdog8528
    @fatcamdog8528 Год назад

    this was so helpful, very quik and ismple

  • @phoenix212
    @phoenix212 Год назад +1

    The expiration date for the JWT token doesn't have to checked manually, it auto checks if you set the expiration to claims["exp"].

  • @jacqdie708
    @jacqdie708 Год назад

    you are incredible, thank you for everything

  • @code1860
    @code1860 2 года назад

    Subscribed. Please keep them coming.

  • @imertkaradayi
    @imertkaradayi Год назад

    I am using apple silicon and compile daemon is not working for me. I can even not install it, it says GOBIN etc

  • @polestartechconsultancy64
    @polestartechconsultancy64 9 месяцев назад +1

    Hi @codingwithrobby I really like your Go videos. Learned a lot from it. I have a question in this video:
    1. You are making authentication using JWT and making a cookie in client. so, my question is, when we use front-end tech, like react or vue, do we need to setup the cookie from the front-end or back-end? if front-end, how will the middleware work? what will be it's code and structure?

  • @Mirislomovmirjalol
    @Mirislomovmirjalol 7 месяцев назад +2

    i didn't get why you checking db in middleware? so what is the point of using jwt then?

  • @bjugdbjk
    @bjugdbjk 2 года назад +1

    Simply Amazing , u made it look so simple, Thanks a ton brother !!
    Could you do something on "Go-lang with kafka"

  • @mikhailkalashnik0v
    @mikhailkalashnik0v Год назад +2

    For part 2, it would be great if you can walk us thru how to turn this into a web page (user registration, login).

  • @cassianoyasumitsu
    @cassianoyasumitsu Год назад

    Thanks man! Learned a lot.

  • @yyovkov
    @yyovkov Год назад

    Thank you for the good tutorial!

  • @iliadmitriev01
    @iliadmitriev01 Год назад

    wonderful tutorial! thanks for your work!
    btw what was the gui postgresql client at 17:18 ?

  • @wandersonsousa1891
    @wandersonsousa1891 2 года назад

    Thank you a lot, great content!

  • @mateenbagheri
    @mateenbagheri 2 года назад

    Very educational and on point.

  • @yudistiraardi8741
    @yudistiraardi8741 10 месяцев назад

    SIR YOU ARE THE BEST! ❤

  • @johnxisde
    @johnxisde 2 года назад

    thanks for this tutorial Robby!

  • @fkaanoz
    @fkaanoz 2 года назад

    it's so good. thank you Robby.

  • @twiggy99
    @twiggy99 Год назад

    I keep getting the error DB declared but not used and I'm not sure why as we are creating the pointer to the DB var in the connect function. Does anyone know why this is happending?
    var DB *gorm.DB
    func Connect() {
    var err error
    dsn := os.Getenv("DB")
    DB, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
    if err != nil {
    panic("Failed to connect to db")
    }
    }

    • @ChristopherPhillipsDev
      @ChristopherPhillipsDev Год назад

      Because you used ":=" which created new variables within the scope of that function. Instead just use "="

  • @mostafa5863
    @mostafa5863 2 года назад +1

    Thanks for your video
    One of the first things that attracted me was the auto import feature
    how can i get it in vs code?

    • @codingwithrobby
      @codingwithrobby  2 года назад +2

      Just install the official go extension for vs code. When you install it’ll suggest some other installs, click “install all”.

  • @jamesmwangi2491
    @jamesmwangi2491 Год назад

    Practical tutorial very nice

  • @agustin6165
    @agustin6165 9 месяцев назад

    Very clear. Thanks

  • @onefiftycanningvale
    @onefiftycanningvale Год назад

    getting a cors error when trying to fetch it on js.

  • @nabazesmail6165
    @nabazesmail6165 Год назад

    Thank you it was amazing ❤

  • @mohamedhabas7391
    @mohamedhabas7391 23 дня назад

    you sir are awesome

  • @mrashad_com
    @mrashad_com Год назад

    Very helpful, thanks

  • @mcphersonsound
    @mcphersonsound 9 месяцев назад

    good video. I ran into an issue where I couldn't sync the database, after multiple hours of debuging to no avail, I just followed along with the rest of the video since I really just wanted to learn the jwt part.

  • @tharaka911
    @tharaka911 Год назад

    great sutff robby....thank you

  • @TheTokesh
    @TheTokesh 2 года назад

    Nice video, thank you!

  • @naimurhasanrwd
    @naimurhasanrwd Год назад

    so helpful to get started

  • @abhishekushwahaa
    @abhishekushwahaa 9 месяцев назад

    Thanks ❤ please make complete Full stack project with go.😊

  • @alifourka3720
    @alifourka3720 Год назад

    thanks for this great video

  • @fernandhadzakysaputraazis57
    @fernandhadzakysaputraazis57 Год назад

    the best tutorial ever

  • @adhdaddventure
    @adhdaddventure 2 дня назад

    Great video. But the validation of the JSON you do does not work it just skips it. You can send an empty body and it will just run through so maybe thats a little fix you can do.

  • @gopalmatcha4436
    @gopalmatcha4436 11 месяцев назад

    thank you, good sir!

  • @ДаниялКожакметов-и9ф

    great tutorial, can i use that cookie based authentication with templates?

  • @gpthaoyugpt
    @gpthaoyugpt Год назад

    thanks it"s helpful for me.

  • @michaeljunaid751
    @michaeljunaid751 16 дней назад

    Wow this video is actually very helpful but I still don't understand how i can relate this to log in & sign up pages because that is what I am looking for but all the tutorials I am seeing is saying exactly this or doing something related to what you are doing and I'm rather new to programming so I would like to get some help

  • @lucasdamasceno7068
    @lucasdamasceno7068 Год назад

    thanks bro, nice project

  • @scottamolinari
    @scottamolinari 2 месяца назад

    Hi thanks for this video. It was great and informative.
    One point of critique though. Wherever your mic is, it makes your keyboard typing sound like an ASMR video and for me, quite distracting. Especially since there is some kind of noise that sounds not normal keyboard like. If the sounds were just the normal thok, thok, thok of a keyboard, I'd almost be ok with it, but your keyboard does some funky noises. 😛🤷‍♂

  • @jamescalvo7956
    @jamescalvo7956 10 месяцев назад

    theres no error catching for no claims on the cookie. this doesnt stop it from working but it causes a panic

  • @kakhabervk9405
    @kakhabervk9405 Год назад

    👍 great!

  • @bastianbangun7726
    @bastianbangun7726 2 года назад

    Amazing tutorial, thanks for share your knowledge

  • @ridemateだよ
    @ridemateだよ 11 месяцев назад

    Bro just got a new sub

  • @Geek-jx3gw
    @Geek-jx3gw Год назад

    the last thing (middleware part is not working) v5 in auth
    i may search a little but if someone worked with them pls put the code

    • @BrenoAlmeida
      @BrenoAlmeida Год назад +1

      It was not working for me too, then I searched for an updated tutorial, using v5, just for this jwt part and everything works perfectly, then I got back to this tutorial. I dont know what was the cause tho.

    • @Geek-jx3gw
      @Geek-jx3gw Год назад

      omg thanks for the reply, i thought i did someth wrong@@BrenoAlmeida

  • @ajith_e
    @ajith_e Год назад

    Thank you!

  • @rivalheriyan1327
    @rivalheriyan1327 Год назад

    awww helpfull thanks bro

  • @diansaputrahadiwijaya4094
    @diansaputrahadiwijaya4094 4 месяца назад

    Greetings Robby,
    I just started learning golang, previously I used angular as a frontend and laravel as a backend.
    I am very helped by the videos you made, can you make a tutorial on golang as a backend and nextjs as a frontend?
    It would be better if it started from JWT Authentication
    Thank you in advance

  • @shanexie2933
    @shanexie2933 2 года назад

    thanks so much!

  • @tony-go-code
    @tony-go-code Год назад +1

    great tutorial, simple easy to understand and powerful.
    could you also make same with Fiber instead of Gin?

  • @buildfromzero
    @buildfromzero 2 года назад

    Perfect 👍

  • @chiragmehta2955
    @chiragmehta2955 4 месяца назад +1

    please share github repo of this,that would be a great help!!