Implementing a login session authentication using React js, Context API and Python Flask API and JWT

Sdílet
Vložit
  • čas přidán 5. 09. 2024

Komentáře • 66

  • @daxmitchell9942
    @daxmitchell9942 Před 3 lety +11

    This is a really excellent video. My suggestion is to make more like it. I also like your short videos but this one is especially great because you can go into depth and show the entire workflow in one video. Awesome job!

  • @HarveyXE
    @HarveyXE Před 3 lety +3

    I found this demo very helpful. Thank you. Your explanation of the project and your troubleshooting along the way are well appreciated.

  • @laxmanc2679
    @laxmanc2679 Před 3 lety +5

    I was looking for this exact tutorial, Beautifully explained!!!!! Loved it

  • @rifqinaufalabdjul5384
    @rifqinaufalabdjul5384 Před 2 lety

    Really helped me! i'm trying to build my first website with frontend and backend wish me luck guys

  • @stantonviaduc4168
    @stantonviaduc4168 Před 3 lety +1

    New channel. Bet its tough to get motivated at first. Im a software engineer and this is quality education. Keep it up and thank you. Subscribed.

    • @4GeeksAcademy_
      @4GeeksAcademy_  Před 3 lety +3

      Thank you! I already have to make this videos for my classes, publishing here is just a perk :)

  • @meetjesusoutreach
    @meetjesusoutreach Před 2 lety

    Very detailed technical explanation. You're a gifted teacher

  • @falcan7752
    @falcan7752 Před rokem

    This demo is the best and helpful. Thank you

  • @manufigueira9
    @manufigueira9 Před 3 lety +1

    Awesome, just what I was looking for. Thanks!

  • @spacetimevideostudio109
    @spacetimevideostudio109 Před 10 měsíci +1

    Very good video, i appreciate

  • @spacetimevideostudio109
    @spacetimevideostudio109 Před 4 měsíci

    Thank you this amazing video

  • @jorgeduardo101
    @jorgeduardo101 Před 11 měsíci

    this is great quality content! love the energy too

  • @ApartmentAngelsFireStarters

    btw this is how you get the token .then(response => {
    alert(JSON.stringify(response.data.access_token))
    console.log(response.data.access_token)
    sessionStorage.setItem('token', response.data.access_token);
    })}
    The way he shows it works half the time with flask, this gets to it fully.

  • @aniketsurve7275
    @aniketsurve7275 Před rokem

    Thanks for the video tutorial, was really helpful!!

  • @JohnMoncler
    @JohnMoncler Před 2 lety

    Great video. Helped me a lot with my project. Thank you sir

  • @francisf.massaquoijr.7291

    Thanks this is extremely helpful, can you kindly create a full blog with flask and react including authentication.

  • @gonzalofernandezvictorio9336

    Awesome 🔥🔥

  • @verygood5377
    @verygood5377 Před 3 lety +2

    Thanks for the video !! Can you do video on production deployment to cloud and how do you expire and refresh the token?

    • @4GeeksAcademy_
      @4GeeksAcademy_  Před 3 lety +1

      Yes, I will add it into the upcoming recordings.

    • @4GeeksAcademy_
      @4GeeksAcademy_  Před 3 lety +1

      Once you create a token in JWT you have no control over it anymore, because you don't store the JWT tokens on any database.
      If you want to be able to "revoke" a token you need to use a different standard like Bearer and store the tokens in your database, that way you "expire" the token by deleting it.

    • @verygood5377
      @verygood5377 Před 3 lety

      @@4GeeksAcademy_ Got it ! I think I will just follow the best practice. Looking forward to your video on how to refresh a token when it is nearly expired.

    • @verygood5377
      @verygood5377 Před 3 lety +1

      @@4GeeksAcademy_ I think many people like me really love to use React JS as front-end app and Flask as back-end app. However, not much on Internet is clearly focused on deployment especially if they are separate apps. For example, I still have problem with the deployment on Azure cloud service with the follow configuration : React JS (front end app) + Flask (backend API) + React JS (msal authentication). It's a challenge !!

  • @ayoubmahjoubi1369
    @ayoubmahjoubi1369 Před 3 lety +2

    Thanks for the video! I have a question about the lifetime of the token ?

  • @olias03
    @olias03 Před 3 lety

    Amazing thank you!!!

  • @BrendanMetcalfe
    @BrendanMetcalfe Před 2 lety +1

    👍👍🔥🔥

  • @RidvanGulce
    @RidvanGulce Před 3 lety

    excellent video

  • @emilioalvear8440
    @emilioalvear8440 Před 2 lety

    Thank you!

  • @pipi_delina
    @pipi_delina Před 3 lety

    This is perfect

  • @lallayakout3443
    @lallayakout3443 Před 2 lety

    Good job

  • @alvinnify
    @alvinnify Před 3 lety +1

    just curious on how we can manage if we have various user roles that access different pages

    • @4GeeksAcademy_
      @4GeeksAcademy_  Před 2 lety

      I would have another table for Role and another for Capabilities, then I would assign capabilities to each role.

  • @eddycarra1519
    @eddycarra1519 Před 3 lety +1

    I am getting an error here for the store and actions. They are listed as undefined which means I can't get through to the token or the login function in the flux.js. Something isn't propagating from the Context being called in my login view. Something must be off in this hook that I am not seeing. Is it possible that I have to use the getActions? I am a bit lost here.

    • @eddycarra1519
      @eddycarra1519 Před 3 lety +1

      Figured it out: On line 45 in the layout.js file you wrap the export with the injectContext function. Definitely something I overlooked. Now the Context works as it is being called by the export of my UserLogin file.

  • @TruthSeekerClub
    @TruthSeekerClub Před 2 lety

    How to send current user logged data to frontend?
    Like id and other info for extra usage e.g. To request item or list by current user ID and show him his list of items in homepage?
    .......
    Do I have to do two requests like get authentication in one request and use token with user email for another request to get logged user info?

  • @maeljourdain885
    @maeljourdain885 Před 2 lety

    If the user enter manually a random token with the command sessionStorage.setItem('token','aaa'), he will overpass the login form, no ?
    The useEffect in the Context when the component is mounted will set the token in the store equal to the token in the sessionStorage.

    • @goobles3991
      @goobles3991 Před 2 lety +1

      You can pass the login, but you wouldn't be able to access the message part of the API which is protected with jwt_required.

  • @HACKINGMADEFUN
    @HACKINGMADEFUN Před 3 lety +1

    I dont know why but I am getting this error: TypeError: Cannot read property 'store' of null ......... at useContext(Context) in login.js
    Any idea how to fix this?

    • @jmkb3616
      @jmkb3616 Před 2 lety

      I have the same issue

    • @jmkb3616
      @jmkb3616 Před 2 lety

      i fixed this issue by exporting the main app with the injection like this:
      export default injectContext(App);

  • @lesliewubbel9157
    @lesliewubbel9157 Před 3 lety

    @49:32 What you doing on lines 25 and 26 this code is not found in your github

  • @Zetnal_
    @Zetnal_ Před 2 lety

    Hi! How can we use emails and passwords that are in the database instead of "test"?

  • @lesliewubbel9157
    @lesliewubbel9157 Před 3 lety

    I am following the template its throwing TypeError: Cannot destructure property 'store' of 'Object(...)(...)' as it is null. from the appContext/Context.js
    the store cannot be null apparently?

    • @lesliewubbel9157
      @lesliewubbel9157 Před 3 lety +1

      Nevermind I fixed it I used this cause stackoverflow.com/questions/37182100/reactjs-warning-input-is-a-void-element-tag-and-must-not-have-children-or-use warning on input tag JSX is really picky.
      Thank you for the video

    • @eddycarra1519
      @eddycarra1519 Před 3 lety

      @@lesliewubbel9157 Where exactly did you use the 's? Since it is null my state.actions doesn't update which causes the store.token to be undefined.

    • @lesliewubbel9157
      @lesliewubbel9157 Před 3 lety

      @@eddycarra1519 do see how he types @49:52 or @49:32 in the JXS, its triggering this error JSX can only exist in the return( jsx_code_here ) basically the doesn't work for some reason I changed it to like a correct HTML tag
      I check out your channels btw I don't know if would like to talk on discord I am looking for help developing a react forent and API

    • @eddycarra1519
      @eddycarra1519 Před 3 lety +1

      @@lesliewubbel9157 oh I see. I was getting the same error for React.createContext can't be null. But found that this was cause my another issue. Which I left a comment for with solution as well.

  • @benjaminlarenasbravo2509

    I'd like the mentors in Chile explain like you jaja the mentor that teach me has no passion with his job

    • @4GeeksAcademy_
      @4GeeksAcademy_  Před rokem

      Can you send me a DM to my twitter at @alesanchezr with more details? I'm really sad to hear this.

  • @akashhebbar1076
    @akashhebbar1076 Před 3 lety

    +1 subscriber

  • @akashhebbar1076
    @akashhebbar1076 Před 3 lety

    is it safe to use localstorage to save token

    • @4GeeksAcademy_
      @4GeeksAcademy_  Před 3 lety

      As safe as I can think of, i’m no security expert thoe

    • @svsamvalvi
      @svsamvalvi Před 3 lety

      No, it's better to implement refresh token.

    • @svsamvalvi
      @svsamvalvi Před 3 lety

      @@4GeeksAcademy_ good tutorial, do this with redux and the refresh token, please.

  • @umaraj2891
    @umaraj2891 Před 3 lety

    i am new to this technology,i am getting error "no module named flask_sqlalchemy" ,but if I install it using pip it says requirement already satisfied,what might be the error then.please suggest..

    • @4GeeksAcademy_
      @4GeeksAcademy_  Před 3 lety

      Its hard to know with the information you provided, usually those errors happen when you have a problem with python versions, what if you install using pip3 instead of pip? Check the version of python you have and maybe you also have python2, my recommendation is to re-install python using pyenv.

  • @AryanGupta-tx6vt
    @AryanGupta-tx6vt Před 3 lety

    dont ignore the rest of files they dont matter ?

    • @4GeeksAcademy_
      @4GeeksAcademy_  Před 3 lety

      What do you mean? On the video description you have access to the original template I sued, and it has videos and explanations no how those files work, but that is not related to authentication so its not in this video :)

    • @AryanGupta-tx6vt
      @AryanGupta-tx6vt Před 3 lety

      @@4GeeksAcademy_ 12:18 and I do appreciate your work !! thanks