Simple React.js User Login Authentication | Auth0

👉 Become A VS Code SuperHero Today: vsCodeHero.com
🚢 Deploy for FREE on Vercel: vercel.com/ambassadors/codest...
Sign up now for the Auth0 Hackathon!! a0.to/hack-cs
August 7 - 9, 2020
In this video, we will add a basic user login with authentication to a React.js app using Auth0. Auth0 is the easiest way for developers to add authentication and build secure applications.
Auth0 makes it easy to add authentication to React with their npm package auth0-react, which uses React context and hooks.
Let me know if you would like to learn more about Auth0.
💻 Code: github.com/codeSTACKr/react-a...
Time Stamps:
00:00 Intro
00:13 Sponsor (Auth0)
00:55 create-react-app / cleanup
02:17 Create Auth0 Application
03:48 Environmental Variables
04:36 Install auth0-react
04:58 index.js
06:45 LoginButton Component
09:34 LogoutButton Component
11:21 Profile Component
14:35 Render Components Based on Auth.
18:05 Show Loading...
_____________________________________
💻 Visit CodingPhase and get unlimited access to programming courses plus 20% 0FF!!
www.codingphase.com/codestackr
_____________________________________
🛠️ Tools I use:
🟠 Theme: marketplace.visualstudio.com/...
🟠 Font: STACKr Code (Exclusive to my VS Code Course - vsCodeHero.com)
🟠 SuperHero Extension Pack: marketplace.visualstudio.com/...
_____________________________________
💖 Show support!
PayPal: paypal.me/codeSTACKr
_____________________________________
Watch Next:
Web Development - Beginners Roadmap (2020) - • Web Developer Roadmap ...
Playlist: Web Development For Beginners - • Web Development - Begi...
_____________________________________
Connect With Me:
Website: www.codestackr.com
Twitter: / codestackr
Instagram: / codestackr
Facebook: / codestackr
_____________________________________
** Affiliate Disclaimer: Some of the above links may be affiliate links, which may generate me a sales commission at no additional cost to you.
#codeSTACKr #React #Authentication

Пікірлер: 236

  • @codeSTACKr
    @codeSTACKr4 жыл бұрын

    👉 Sign up for my newsletter to stay up-to-date on my new course: codestackr.com

  • @mohamedsamsudeen7372

    @mohamedsamsudeen7372

    8 ай бұрын

    hi

  • @BlockCylinder
    @BlockCylinder2 жыл бұрын

    Really well done. I'm following this tutorial nearly two years later, and I'm integrating Auth0 into an existing React application, and it went smoothly from start to finish. We all know how rare that is, even with more recent clips from mainstream channels.

  • @AyanKhan-dc3eu

    @AyanKhan-dc3eu

    2 жыл бұрын

    please help me out my react app on desktop is working fine but on android browser its a blank white screen after using auth0

  • @JamesQQuick
    @JamesQQuick4 жыл бұрын

    I'm biased but this video was great!! Auth0 makes auth in React so easy :)

  • @khandoor7228
    @khandoor72284 жыл бұрын

    Stackr this was awesome. I think you just saved me years of my life not having to write all that authentication!!! You continue to impress with your code and delivery. So many people making these videos don't have (or don't know how to use) plugins and autocomplete and up to date syntax and it makes watching their videos frustrating (due to it taking so long to do simple things) but your code and syntax is up to date and on point. So not only do I learn the topic but pick up a few tips and tricks as well!! Awesome job man!!

  • @codeSTACKr

    @codeSTACKr

    4 жыл бұрын

    Thank you! I appreciate that!

  • @kevdevgame8763

    @kevdevgame8763

    2 жыл бұрын

    @@codeSTACKr hi , thanks for thr content and I want to know if it's totally free

  • @albert21994
    @albert219943 жыл бұрын

    you, mate, saved my freelance carreer.

  • @Eeezus1914

    @Eeezus1914

    3 жыл бұрын

    mine as well

  • @faizibnfarhan

    @faizibnfarhan

    3 жыл бұрын

    hey can you help me to get freelance react and next js projects ?

  • @albert21994

    @albert21994

    3 жыл бұрын

    @@faizibnfarhan ​ @Muhammad Faiz Khan React/next alone isn't gonna cut it. Networking is my most successful way of getting gigs; I even get messaged on LinkedIn if your CV is promising. - You need to sell solutions, not your skill set. A client doesn't care about what React/NextJS is; he cares about how you develop his vision, which is mostly a fancy/minimal website experience. Skilled Frontend Dev's are in demand. Several KZread channels are even advertising for positions. I imagine most clients feel more comfortable, with the following: - Excellent English because a client needs to feel comfortable with you communicating in a way that avoids misunderstandings. - Computer Science Degree (finished, enrolled, or similar): Despite everything you hear on YT or read online on course websites, most clients don't wanna work with beginners. They think of a degree as something as a "proof of competence." It helped me a lot with more conservative, higher-paying jobs. - Portfolio / Open-Source Contributions: As said, showing you are not a beginner, like the other guys on Fiverr or similar, by showing off how competent you are in a Portfolio assures a client can know what he's getting from you. Most of them don't bother with the portfolio, but it's a way of taking confidence in your work. - People notice that. Open Source Contributions can build your portfolio significantly. Even more, if they're on big projects. Also, they are a good way of networking. tl;dr show off your work and use your soft skills. Networking lands most jobs.

  • @permender4111

    @permender4111

    3 жыл бұрын

    @@albert21994 thanks....above information is really helpful.....

  • @CodyPellom
    @CodyPellom2 жыл бұрын

    Great video thank you so much. This react auth is a turn on and is helping me want to learn more (again) about react for building something with a login. You rock bud.

  • @TheWandererDoc
    @TheWandererDoc4 жыл бұрын

    so what is related to JWT ? or its the same we can use jwt or auth0

  • @shadmerhi
    @shadmerhi3 жыл бұрын

    This is an amazing video! How do you retrieve the form contents if the user decides to login by manually creating an account? I'd love to see more Auth0 videos from you.

  • @remp1040
    @remp10403 жыл бұрын

    Love this video!!! Thank you for making it easy to understand!!

  • @yashdefy
    @yashdefy3 жыл бұрын

    what if I want to use my own login screen and then redirect to authentication? without entering the credentials in Auth0 login screen?

  • @ahmedlabeeb2969
    @ahmedlabeeb29693 жыл бұрын

    Liked the video, subscribed, want to learn more about authentication! Thanks man!

  • @ruballa27
    @ruballa273 жыл бұрын

    great job - with so many of these types of vids out there, yours stands out

  • @codeSTACKr

    @codeSTACKr

    3 жыл бұрын

    Thank you!

  • @bendechrai
    @bendechrai4 жыл бұрын

    File me under biased too, but that was so clear and easy to follow. Thanks ❤

  • @kellyemeka7
    @kellyemeka73 жыл бұрын

    Yes yes, more auth videos pleaseeeeeeee... This was really great,

  • @ioannispotouridis297
    @ioannispotouridis2973 жыл бұрын

    Just wrap your code in you don't need extra packages for formatting the JSON 😁

  • @Rashmieditz

    @Rashmieditz

    3 жыл бұрын

    hey, thanks buddy for tip

  • @danieltkach2330

    @danieltkach2330

    3 жыл бұрын

    Awesome.

  • @jamest5153
    @jamest51532 жыл бұрын

    I have had issues with auth for a while and this tutorial has made it simple to add it to my future react apps. Thanks for this!

  • @AyanKhan-dc3eu

    @AyanKhan-dc3eu

    2 жыл бұрын

    please help me out my react app on desktop is working fine but on android browser its a blank white screen after using auth0

  • @yologonzalez7365
    @yologonzalez73654 жыл бұрын

    Can u please post more about auth0 , this short tutotrial was amazing

  • @eleah2665
    @eleah26654 жыл бұрын

    Yes, more about authentication. Thanks.

  • @tisaroo555
    @tisaroo555 Жыл бұрын

    Brilliant content! No need to speed up the video... you go at a great speed by default.

  • @JoshAllan
    @JoshAllan3 жыл бұрын

    Random question, but what VSCode theme are you using? Really dig the colors!

  • @sheeraz1022
    @sheeraz10223 жыл бұрын

    This video is really great. Easy to understand. I will definitely build up a sample application using Auth0.

  • @codeSTACKr

    @codeSTACKr

    3 жыл бұрын

    Glad you enjoyed it!

  • @mathewdavies1480
    @mathewdavies1480 Жыл бұрын

    Great tutorial and OAuth is a great technology. One note of caution - your API keys can be viewed by anyone, (even in the .Env file) using the browser tools if you put your site live, which is a security no no. In production the keys would be hidden on the back end and served up to the front end via an API. You can also look into hiding your API keys in React to find solutions, most of which will involve making a simple back end to store and serve the keys.

  • @jamezjaz
    @jamezjaz2 жыл бұрын

    I just bumped into this tutorial and it was awesome! To be honest, it’s clearer than auth0 docs. Thanks for sharing

  • @swapnilbhalerao3801
    @swapnilbhalerao38012 жыл бұрын

    application is starting well ,but after log in it is not loading the next respective page ,please help

  • @AyanKhan-dc3eu
    @AyanKhan-dc3eu2 жыл бұрын

    my react app on desktop is working fine but on android browser its a blank white screen after using auth0. please help me out

  • @travezripley
    @travezripley4 жыл бұрын

    Thank you... You're content is my favourite!!! Youre giving us the best stuff right now!!! Thank you again!

  • @codeSTACKr

    @codeSTACKr

    4 жыл бұрын

    Wow, thank you!

  • @khandoor7228

    @khandoor7228

    4 жыл бұрын

    @@codeSTACKr Agreed you are doing a super job right now!!!

  • @barelylate
    @barelylate2 жыл бұрын

    @8:50. anyone else get stuck here? it keeps telling me my credentials to login are invalid even though I am using them to login on a different tab in the same browser

  • @sundardass5511
    @sundardass55112 жыл бұрын

    Hey mate , in console after clicking login button it shows,Loginwithredirect is not a function

  • @Smurfis
    @Smurfis Жыл бұрын

    Is there anymore use cases for things such as Auth0 like chat rooms and such? Or permissions and admin panel access? I’m just curious as to how to deploy such things.

  • @yashkumbhar9844
    @yashkumbhar98442 жыл бұрын

    Very easy explanation and best video out there. Thank you man.🙌

  • @codeSTACKr

    @codeSTACKr

    2 жыл бұрын

    Glad it helped!

  • @theunpropheticchannel9565
    @theunpropheticchannel95653 жыл бұрын

    Thank you so much for making such a straightforward video! One issue though, when I click the login button and I am taken to the Auth0 login page, I get an alert saying that I am using Auth0 development keys. How should I fix this issue?

  • @kashyapKbandi
    @kashyapKbandi2 жыл бұрын

    Thanks ! By far the best , clear and easy tut . Quick question (generic) . When I deploy my app say on firebase , Can I still use .env file contents ? Will that still work ? Or should I be making any changes ?

  • @ruchiray8557
    @ruchiray85573 жыл бұрын

    what if i want to use context js and wrap my app around AppProvider as well as auth0 ??

  • @abhisekray9622
    @abhisekray96223 жыл бұрын

    hello sir why my domain and clientId is undefined after using the .env file

  • @aniketkulkarni7747

    @aniketkulkarni7747

    3 жыл бұрын

    You need to restart server after every change in .env file. So if your server was running and u created .env file after that just npm start again

  • @dylancorr8054
    @dylancorr80542 жыл бұрын

    Hey I'm running into a problem when I click the log in button it can't reach the authentication page. What could be the problem. It says it's undefined in the url bar

  • @luciolucio6544
    @luciolucio65443 жыл бұрын

    Super clear, super good audio. I love you

  • @codeSTACKr

    @codeSTACKr

    3 жыл бұрын

    Yay, thank you!

  • @thallesaugusto3540
    @thallesaugusto35402 жыл бұрын

    I love it, but i have a question, is possible to edit the login screen of auth0?

  • @ManjiriParab19
    @ManjiriParab192 жыл бұрын

    If user signup in react application then how to make automatic login in wordpress account using sso please guide

  • @shironekomaru4370
    @shironekomaru43703 жыл бұрын

    Hi! Just wanted to know if do you have some resource or to utilize email address whitelist? Thank you very much.

  • @tonycavanagh1929
    @tonycavanagh19292 жыл бұрын

    Hi did you create a vids for Auth0 where you set up tenent settings, to allow someone to login using a HTMLRequest. To get that working you need to set up Default Audience and Default Directory. Auth0 documentaion seem very shy in explaining what they are. Thanks

  • @joelgarcia8916
    @joelgarcia89163 жыл бұрын

    Easy and integrated in electron thanks buddy !

  • @erickgeneric
    @erickgeneric3 жыл бұрын

    Best, concise video on the topic. Subbed 👍

  • @codeSTACKr

    @codeSTACKr

    3 жыл бұрын

    Awesome, thank you!

  • @hernan869
    @hernan8693 жыл бұрын

    Great video! but i got a question, how can I handle multiple type of users? I mean, like an admin and so on...

  • @veereshsuryac9121
    @veereshsuryac91213 жыл бұрын

    How easy it was ! Thank you very much ❤️.

  • @codeSTACKr

    @codeSTACKr

    3 жыл бұрын

    You're welcome 😊

  • @ChadDavid
    @ChadDavid2 жыл бұрын

    How can you accomplish the same with a local DB using an API?

  • @raniaelhor3894
    @raniaelhor38942 жыл бұрын

    does it still work if i don't buy the full version ?

  • @kshayk0
    @kshayk02 жыл бұрын

    can i somehow manage user roles (or other custom user attributes) in the registration itself? also, besides the obvious user object, can i store roles and other custom attributes in the local storage under the same user object? i'm trying to play with it and the code gets messy

  • @Minecraftzocker766
    @Minecraftzocker7664 жыл бұрын

    Great tutorial! A video about protected routes using react-router would be nice

  • @codeSTACKr

    @codeSTACKr

    4 жыл бұрын

    Great suggestion!

  • @klaasp1976

    @klaasp1976

    2 жыл бұрын

    +1

  • @hsrkfzycfod8
    @hsrkfzycfod83 жыл бұрын

    Is it possible to use Auth0 to manage additional user info? For example, I'd like to offer a service through a monthly subscription through a web app. I could check whether or not the user has an active license by putting a "licenseExpirationTimestamp" or something like that alongside the user's info. Would you recommend using something else, maybe Firebase or MongoDB Atlas (or MongoDB self-hosted) or is it possible to do this with Auth0? I've looked into it, but since I'm new to React + Express Node.js I'm not really sure about what the optimal solution for my problem would be. Thanks!

  • @bdb1899
    @bdb18992 жыл бұрын

    Hello sir I have an error in reactJs login authentication. How can I do

  • @vivianelauresop1611
    @vivianelauresop16113 жыл бұрын

    Nice tutorial! A video about login with github using OAuth would be nice

  • @chiranjeevigk6298
    @chiranjeevigk6298 Жыл бұрын

    Hi ....I have performed all the steps, on click of login button it is not routed to page , it is showing "This site can't be reached"

  • @gmacdonalddc
    @gmacdonalddc11 ай бұрын

    Thanks for this, appreciate it!

  • @boneBasterd
    @boneBasterd3 жыл бұрын

    Hey, Thanks for this video, this helped me a lot! I'm forever grateful!

  • @codeSTACKr

    @codeSTACKr

    3 жыл бұрын

    Glad it helped!

  • @gregmall3339
    @gregmall33393 жыл бұрын

    amazing solution! my new goto for react auth components

  • @codeSTACKr

    @codeSTACKr

    3 жыл бұрын

    Great!

  • @johnwilliams7999
    @johnwilliams79993 жыл бұрын

    How do you set this up if you only want 1 user to be able to log in. For example if u want to access some hidden features of ur home page for maintenance etc... when I use the 0auth module it seems anyone can log in or register.

  • @MrStuartp
    @MrStuartp2 жыл бұрын

    Brilliant, so simple and well explained.

  • @wrushu
    @wrushu4 жыл бұрын

    Signin with Google causing 400 error it redirects to /authorize, but it works with user\password

  • @ToolboxMachinima
    @ToolboxMachinima Жыл бұрын

    Great video. Super helpful

  • @venusirpuram4345
    @venusirpuram43453 жыл бұрын

    I have a doubt, I didn't understand what you at 16:20. Can you please explain

  • @ibrahimacanada
    @ibrahimacanada Жыл бұрын

    Great Tuto ! thanks

  • @mulcro
    @mulcro Жыл бұрын

    Thanks for this video very simple to follow and packed with useful info

  • @adityapawar7463
    @adityapawar74633 жыл бұрын

    thank you soo...... much, it helped in my reactjs app, the code was literally so little

  • @RNMERIA
    @RNMERIA4 жыл бұрын

    well crystal clear explanation, I have subscribed. If you can follow this with a use case example, that would be great. Thank you

  • @lifewithysa2461
    @lifewithysa24613 жыл бұрын

    there you have it.. explained very well.. it seems to me that its like offloading your users data to a third party in exchange of flexibility the question is as a developer do you want that?

  • @codeSTACKr

    @codeSTACKr

    3 жыл бұрын

    I sure do :)

  • @MeghnaSharma
    @MeghnaSharma3 жыл бұрын

    Is this implicit grant?

  • @acushlakoncepts
    @acushlakoncepts3 жыл бұрын

    Great one, I love it

  • @s.sandeepkumarselvam.m1630
    @s.sandeepkumarselvam.m1630 Жыл бұрын

    Thanks for your video sir 🤗 can you explain how to implement microsoft authentication

  • @pranamyavadlamani5979
    @pranamyavadlamani59793 жыл бұрын

    I tried using this in my already existing project. But when I clicked the newly created login button, nothing is happening. Somebody please help

  • @luan123z
    @luan123z Жыл бұрын

    How can I tell Auth0 to redirect to a another page instead of the home page?

  • @ozgur95
    @ozgur953 жыл бұрын

    Can we customize Auth0's login and signup modal?

  • @arushigupta2112
    @arushigupta21123 жыл бұрын

    Hi, this video is really helpful. Although, i am getting the same error as many others while hitting the Log In button, If anyone got any solution to it, kindly share. Thankyou. :)

  • @ShubhamSingh-bj3ms
    @ShubhamSingh-bj3ms2 жыл бұрын

    my authorize page is not coming its givig error VM83:6770 crbug/1173575, non-JS module files deprecated. help

  • @w2ytube
    @w2ytube4 жыл бұрын

    Hi Stackr Awesome tutorial as usual. I have a question regarding the process.env usage. I don't see that you are using dotenv package nor require('dotenv').config() call to get all env variables. So how could it work? Thanks in advance

  • @w2ytube

    @w2ytube

    4 жыл бұрын

    Sorry, for my stupid question. I didn't catch that you used react built-in env variables (prefixed with REACT_APP). Note that dotenv cannot be used on client side so in this case the config() call returns an error.

  • @kevdevgame8763

    @kevdevgame8763

    2 жыл бұрын

    @@w2ytube thanks you

  • @ms.emirhan
    @ms.emirhan3 жыл бұрын

    If we refresh page, login is gone and we need to re-login. How to solve it?

  • @aaronkplatt
    @aaronkplatt3 жыл бұрын

    Thank you! This helped so much!

  • @codeSTACKr

    @codeSTACKr

    3 жыл бұрын

    You're welcome!

  • @shangshi6286
    @shangshi62863 жыл бұрын

    Thank you! Why at 12:35, I don't see the false displayed in the browser? I console.log (user) but it's showing me undefined. I wondering why the "false" isn't showing up on my screen.

  • @shangshi6286

    @shangshi6286

    3 жыл бұрын

    something must have changed in the Auth0 API, I'm enable to see the return value after I log in. but if I'm logged out, I'm not able to see anything with JSON.stringify(user)

  • @ProfessionalTycoons
    @ProfessionalTycoons3 жыл бұрын

    very easy to follow and direct thanks

  • @codeSTACKr

    @codeSTACKr

    3 жыл бұрын

    Glad it was helpful!

  • @palomamorais5079
    @palomamorais5079 Жыл бұрын

    Perfect, working great. Really nice tutorial!

  • @kmchmk
    @kmchmk2 жыл бұрын

    Really useful. Thank you very much.

  • @kalagan
    @kalagan3 жыл бұрын

    The problem is that you have to create a login button first for the Auth0 loging page to show up. Which is counter intuitive, you want users to arrive straight into the log in page, not another page with a login button you have to click, to then be redirected to the actual login page.

  • @zlackbiro
    @zlackbiro3 жыл бұрын

    What is the name of JSX autocomplete addon?

  • @owaisulhaq7681
    @owaisulhaq76813 жыл бұрын

    The video is good. I would like to encourage you to explain it more. Thank You

  • @mattmarkus4868
    @mattmarkus48683 жыл бұрын

    is Auth0 free for me to use with another identity server?

  • @khandoor7228
    @khandoor72284 жыл бұрын

    PLEASE do something with image uploads. I need to get better with AWS S3 buckets and Multer and saving to MongoDB that whole crazy mess. Maybe with title and description so I can see how to save an image with other items in a form. Sorry I'm rambling...

  • @shreyashs7266
    @shreyashs72662 жыл бұрын

    Thank you Sir! Its working 😀

  • @TutorialesBilingues
    @TutorialesBilingues2 жыл бұрын

    Please, teach us more about Authentication. Regards!

  • @dawid_dahl
    @dawid_dahl2 жыл бұрын

    Thank you so much. Subscribed!

  • @codeSTACKr

    @codeSTACKr

    2 жыл бұрын

    Awesome, thank you!

  • @jgvlc
    @jgvlc3 жыл бұрын

    Thank you for your time, amazing tutorial!

  • @codeSTACKr

    @codeSTACKr

    3 жыл бұрын

    Glad it was helpful!

  • @nischalrapireddy
    @nischalrapireddy3 жыл бұрын

    How did u make your Vscode like the smooth thing like whenever u type or delete Code it's smooth how to do that??

  • @chitrangsharma

    @chitrangsharma

    3 жыл бұрын

    Just have a good pc 😅 I guess

  • @nischalrapireddy

    @nischalrapireddy

    3 жыл бұрын

    @@chitrangsharma uhm I have Ryzen 7 2700x and GTX 1660 super I guess that's a good pc 😅😅😅

  • @OrincyWhyteDesigns
    @OrincyWhyteDesigns2 жыл бұрын

    this was pretty cool

  • @orenvaknin846
    @orenvaknin8463 жыл бұрын

    Thank you very much! your video is very helpful!

  • @codeSTACKr

    @codeSTACKr

    3 жыл бұрын

    Glad it was helpful!

  • @cookiebinary
    @cookiebinary3 жыл бұрын

    what a fancy cursor.. is it a plugin? and is it cross-IDE (JetBrains IDEs ..etc)?

  • @codeSTACKr

    @codeSTACKr

    3 жыл бұрын

    It's just VS Code cursor settings

  • @kamalkamals
    @kamalkamals3 жыл бұрын

    ther is way for register ?

  • @kunaljoshi8730
    @kunaljoshi87302 жыл бұрын

    wow! amazing tutorial! thank you so much!

  • @realsemig
    @realsemig3 жыл бұрын

    What editor and font theme is that? Really nice

  • @codeSTACKr

    @codeSTACKr

    3 жыл бұрын

    Cobalt2 and Fira Code Font

  • @realsemig

    @realsemig

    3 жыл бұрын

    @@codeSTACKr Thanks you!

  • @kashmirtechtv2948
    @kashmirtechtv29482 жыл бұрын

    Your VS Code theme?

  • @pedrovsn
    @pedrovsn3 жыл бұрын

    Everytime i refresh the page i have to Log In again in my application. Can anyone help me please??

  • @VinitDave
    @VinitDave4 жыл бұрын

    Can you do a video on saml authentication with react and auth0...

  • @antons7210
    @antons72102 жыл бұрын

    You just saved me hours. Thank you!

  • @codeSTACKr

    @codeSTACKr

    2 жыл бұрын

    Glad I could help!