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!
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.
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.
@@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.
@@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 !!
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.
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.
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?
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.
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?
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?
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 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
@@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.
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..
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.
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 :)
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!
Will do!!
I found this demo very helpful. Thank you. Your explanation of the project and your troubleshooting along the way are well appreciated.
I was looking for this exact tutorial, Beautifully explained!!!!! Loved it
Really helped me! i'm trying to build my first website with frontend and backend wish me luck guys
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.
Thank you! I already have to make this videos for my classes, publishing here is just a perk :)
Very detailed technical explanation. You're a gifted teacher
Thank you!
This demo is the best and helpful. Thank you
Awesome, just what I was looking for. Thanks!
Very good video, i appreciate
Thank you this amazing video
Glad you liked it!
this is great quality content! love the energy too
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.
Thanks for the video tutorial, was really helpful!!
You're welcome!
Great video. Helped me a lot with my project. Thank you sir
You are welcome
Thanks this is extremely helpful, can you kindly create a full blog with flask and react including authentication.
Awesome 🔥🔥
Glad you like it
Thanks for the video !! Can you do video on production deployment to cloud and how do you expire and refresh the token?
Yes, I will add it into the upcoming recordings.
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.
@@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.
@@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 !!
Thanks for the video! I have a question about the lifetime of the token ?
Amazing thank you!!!
👍👍🔥🔥
excellent video
Thank you!
This is perfect
Good job
just curious on how we can manage if we have various user roles that access different pages
I would have another table for Role and another for Capabilities, then I would assign capabilities to each role.
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.
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.
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?
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.
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.
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?
I have the same issue
i fixed this issue by exporting the main app with the injection like this:
export default injectContext(App);
@49:32 What you doing on lines 25 and 26 this code is not found in your github
Hi! How can we use emails and passwords that are in the database instead of "test"?
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?
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
@@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.
@@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
@@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.
I'd like the mentors in Chile explain like you jaja the mentor that teach me has no passion with his job
Can you send me a DM to my twitter at @alesanchezr with more details? I'm really sad to hear this.
+1 subscriber
is it safe to use localstorage to save token
As safe as I can think of, i’m no security expert thoe
No, it's better to implement refresh token.
@@4GeeksAcademy_ good tutorial, do this with redux and the refresh token, please.
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..
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.
dont ignore the rest of files they dont matter ?
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 :)
@@4GeeksAcademy_ 12:18 and I do appreciate your work !! thanks