Add Login/Auth to your React app in 5 mins

Поделиться
HTML-код
  • Опубликовано: 4 июл 2024
  • If you are looking for an easy and fast way to add authentication to your React application without going through the painful process of handling cookies/localstorage and manipulating all the variables to get simple authentication working. And it doesn't stop just here, as developers, we set up a lot of new projects and it kind of feels tiring to keep doing the same thing or even copy/pasting 😲
    🎉Our Newsletter is live! Join thousands of other developers
    islemmaboud.com/join-newsletter
    ⭐ Timestamps ⭐
    00:00 Intro
    00:27 The Auth Kit library
    01:25 Simple Login UI
    02:02 UXPin sponsored video
    02:42 Your Authentication Server (login/register)
    04:12 Adding authentication to log-in
    09:44 Protected routes (only authorized)
    11:17 Add Signout
    12:41 Cookies are fantastic!
    ⚡️ React Easy Auth repo
    github.com/ipenywis/react-eas...
    ➡️ Build Login/Register API Server w/ Authentication | JWT Express AUTH using Passport.JS and Sequelize
    • Build Login/Register A...
    🧭 Turn Design into React Code | From prototype to Full website in no time
    • Turn Design into React...
    🧭 Watch Tutorial on Designing the website on Figma
    • I Design a onecolor We...
    🧭 Watch Create a Modern React Login/Register Form with smooth Animations
    • Create a Modern React ...
    🧭 Debug React Apps Like a Pro | Master Debugging from Zero to Hero with Chrome DevTools
    • Debug React Apps Like ...
    🧭 Master React Like Pro w/ Redux, Typescript, and GraphQL | Beginner to Advanced in React
    • Master React Like Pro ...
    🧭 Learn Redux For Beginners | React Redux from Zero To Hero to build a real-world app
    • Debug React Apps Like ...
    🧭 Introduction to GraphQL with Apollo and React
    • Introduction to GraphQ...
    🐦 Follow me on Twitter: / ipenywis
    💻 Github Profile: github.com/ipenywis
    Made with 💗 by Coderone

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

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

    🎉Our Newsletter is live! Join thousands of other developers
    islemmaboud.com/join-newsletter

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

    Thank you man, you gave just basics and gave them well

  • @stonecomstock
    @stonecomstock Год назад +8

    This is extremely helpful. Thank you so much!

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

    thanks Islem, this was very useful, doing that manually can be a pain, I'll be considering using this lib as a solution for handling authentication, cheers.

  • @FreeCodingWorld
    @FreeCodingWorld 4 месяца назад +41

    title says 5 mins, but the duration of the video is 13+ mins💀💀💀

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

      Which is funny cuz he's using a framework to speed up & simplify authentication

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

    Helped me to go around React authentication with my Spring Boot App, it worked like a charm

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

    great vid. helped me alot

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

    Thanks for this video

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

    Thanks a lot mate. You have saved a lot time

  • @reyaustineechavez9600
    @reyaustineechavez9600 Год назад +19

    Hi Bro, thanks for the tutorial, I'm just wondering if you could do an extended tutorial on how to setup access levels or user roles?

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

    Can you make a refresh token video on this library?

  • @user-md6dw5zh1f
    @user-md6dw5zh1f Год назад

    If I need to be authorized in multiple subdomains and on a domain, is this possible with your library?

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

    What is the name of the theme you're using?

  • @NoumanKhan-ck7vx
    @NoumanKhan-ck7vx Год назад +2

    how to use refresh token please tell

  • @edena276
    @edena276 8 месяцев назад

    That's not working for me ...
    It says babel pacakges error. And when running this with a project using SWC instead of babel, it totally break my app ...

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

    how to use refresh token?

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

    awesome video

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

    i am waiting for your videos

  • @Chmelewsky
    @Chmelewsky 10 месяцев назад +4

    glad i'm not the only one who refers to auth as creepy stuff 🤣

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

    How do i persist login after refresh?

  • @push-to-talkpodcast2864
    @push-to-talkpodcast2864 Год назад

    theme?

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

    I get an infinite loop after SignOut or go to Private Routes

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

    thanks

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

    Very nice and hjelpfull tutorial, thanks. but i would like to now what vsc color theme you are using. could you tell me some extensions you are using? couse i like it. thnaks in again.

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

      The theme is halcyon. Thanks ^^

  • @vosid977
    @vosid977 8 месяцев назад

    what's that ide?

  • @nabinsaud4688
    @nabinsaud4688 Год назад +5

    Please also provide the link of api used in this video

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

      He literally did in the description. Also used Yarn…

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

    api not working

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

    big fan of you

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

    getting error "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."

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

    im getting an error: annot update a component (`AuthProvider`) can you please help me?

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

    Hi, the cookies are deleted when I refresh the page. Are they supposed to do that?

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

      did you solved this problem?

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

      ​@@murilobarbosa5062 actually I didn't so I choose to save the token on the browsers state

    • @philsmithies
      @philsmithies 8 месяцев назад

      @@murilobarbosa5062the usual way is to set it in your react context that wraps around the application

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

    Sometimes I think content creators are so funny. You just released a video "why JSON web tokens suck! You should stop using them!" 😂 Idk I find it funny

  • @alcideswenner
    @alcideswenner Год назад +3

    What vscode theme are you using?

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

    i'm getting this message Module '"react-auth-kit"' has no exported member 'AuthProvider'. Did you mean to use 'import AuthProvider from "react-auth-kit"' instead

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

      oh nevermind, I saw an issue in the docs saying I need to install react-auth-kit@2.12.7 instead

    • @nadeemr1070
      @nadeemr1070 7 месяцев назад +1

      @@unmye yes it fixed my error too.

    • @dzbro1194
      @dzbro1194 6 месяцев назад +1

      ​@@unmye thanks for this comment, it fixed my error

  • @gameplayerita5694
    @gameplayerita5694 Год назад +3

    could the kit be used with nextjs?

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

      The docs of "react-auth-kit" library says: "Works with Gastsby, Next JS".

  • @mickey-ij7un
    @mickey-ij7un Год назад

    How can I prevent user from accessing '/login' as authorized user? I'm looking for something like the opposite to

  • @user-it9gq5cx6n
    @user-it9gq5cx6n 5 месяцев назад +2

    Hi i am getting following error.
    Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
    react-dom.development.js:28439 Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
    App.js



    } />

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

    can you make the same app but with next js? wnna see how to implemennt this with next js and also http only cookie

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

      i think for nextjs, nextauth is the only library than can really work well

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

      @@monarchgam3r next auth is full stack loking for secure client side

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

      @@zakidzz well this library can't work for that..as it requires react router dom

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

      @@monarchgam3r thnk s man

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

      @@zakidzz are u already know how to make auth with next js for client side only?

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

    Is it safe to store the jwt token in client side cookie?

    • @aniket-in
      @aniket-in Год назад +3

      Nope, you are vulnerable to XSS attacks.
      The authentication token cookie must be set from the server.

  • @BADGRAPHIX
    @BADGRAPHIX 8 месяцев назад +1

    7:03 is where he starts getting into the meat of what you actually do.

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

    So you are saying that doing it from the scratch, understanding each and every step, controlling and customizing the process is crappy and creepy stuff?

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

    it's not 5 mins

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

    less then 5 min and this video is of 13 min 😂😂

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

    hy guys, when I use
    const auth = useAuthUser();
    console.log(auth().email);
    I get error "Object is possibly 'null'.ts(2531)" Could anybody help? thx