Login Authentication Tutorial in React Native using AsyncStorage | useReducer, useContext, useMemo
ฝัง
- เผยแพร่เมื่อ 8 ก.ย. 2024
- In this tutorial, you'll learn how to implement login authentication in react navigation v5 for react native app. I have used AsycStorage, useReducer hook and context API to implement global state management for our authentication.
GitHub repo for this complete project bit.ly/3dZfb7U
React Navigation v5 Tutorial Series • React Navigation 5 Tut...
If you found my tutorials helpful, you can buy me a coffee from this link paypal.me/itzp...
Follow me on GitHub github.com/itz...
Subscribe to my Channel bit.ly/2PaUqOk
For more tutorials on WordPress, React JS, React Native and Digital Marketing visit: www.pradipdebna...
What I like most about this video is that you took it in two steps, so that allows me and my team to understand the context api first and THEN the reducer, which IMO are two separate and equally difficult concepts to understand.
Thanks!
He covered almost everything in react-navigation version 5. I highly recommend this video for development. lots of learning from it. Thank you so much. Looking more tutorials from you.
Thanks for your comment & support.
@@itzpradip How can I implement this auth flow with redux??
Thank you for the tutorial, it was very helpful, even the way that it is presented: you dont just throw codes on our faces, you took the care to explain what each function does and how to use them. Greetings from Brazil!
Glad it was helpful!
3 years later still saved my ass thank you so much
I'm glad that it helped you. 😀
Man, thank you!!! You just save my life! I spend about a day read articles, but all of the articles about auth is is not explaining what's happening in details, but with your video I make it just for the 1 our! THAAAAAANX A LOOOOOT!!!!
This is by far one of the best tutorials for authentication flow using v5. Amazing work. Keep it up
Wow, thanks!
@@itzpradip Hey Bro, your videos are really awesome and you explained each and everything in a very easy way, can you please extend this tutorial and connect this app with firebase (for Authentication and all) please
Thank you for your effort. You did a great job and by far, the best and most simplistic tutorial on the internet for this topic!
Wow, thanks!
Thank you so much. You saved me. I searched a lot but unable to find a good resource for beginner learning auth.
This still useful for me in 2022. Well organised content that I can absorb easily.
Sir thank you very much, I am professional react native developer but watching your tutorial for getting knowledge about new RN features. I must say u explained and mentioned everything latest. Thanks again for your great playlist :)
Glad to hear that
You are the legend of ReactNative thank you for your effort and the way how you explain and simplify it. 👍🏼
I've been searching the authentication tutorial of react native and this video is the solution! keep up the good work man!
Just discovered your channel and I must admit your videos are great. Thanks
This is the simplest tutorial I found so far. Great job. Thanks a ton.
Sir, this is something that I exactly wanted. This is literally saving my life. Thank you so so much.
This playlist is amazing.
Thanks , i follow step by step and manage to use jwt token in my react native app ... cheers
Very Very useful video bro! Keep Going ... I'll give my full support !
Thank you, please allow me to note for my works !
8:37 - Sign out in DRAWER screen.
19:35 - Async. 20:51 - explanation.
Wonderful tutorial, i'm so glad i found your video.
I've been struggling for hours, and you're literally the only one that made it simple!
Thank you so much !!
I really love your tutorials man. You help me so much as I am a web developper and I'm developping my first ever mobile app thanks to you.
Awesome login authentication sir,
This video help me to implement my first app login and auth.
Thanks sir
I have watched many videos on this topic and yours is the most succinct. Thank you!
Wow, thank you!
Thank you so much for the work you have done!💪👍 Your videos are very helpful and informative! Greetings from Ukraine!
best tutorial ever
you are awesome. I learned a lot. Reaally informative keep up the good work much love from Sri Lanka
Thank you very much sir. I must confess that your tutorials has really helped me in many projects and i can't thank you enough. Keep the good work going. Meanwhile, on your login tutorials, i would like you to add more details like, how to accept custom fields from the registration page. I want to learn how to collect users country and display name and add them to the firebase console. Please make tutotrial on this.
thank you! from Vietnam with love
Awesome Learning. Thank you so much for this gift !! Greetings !!
Thank you so much for this. It really helped to clarify things for me in react Navigation v5.
Glad it helped!
thinks from making this video...I will gain lot of knowledge.. from ur video
Really again Lucky to have you for this tutorial
Cant thank you enough. Thanks man for such a clean explaination
Nice concept explaining us, thank you . And we need more tutorials from you
Thanks, keep supporting for more tutorials like this.
You are awesome.... Saved my heap of days.
Thank you so much !! great tutorial.
Nice teaching Sir, I g through all the tutorials of mosh but can't implement the authentication, now I implemented the authentication working fine,
Also If you do some code into different files it will understandable good
Thank you very much. I learned a lot of things from this video list
Thank you Pradip.
Thank you so much! This is what i'm looking for and my code worked!!
can you make one more tutorial with a sample API?
I am not getting this point,, whether we have to call our API from signInScreen or App.js , if we call our API in app.js then how can we handle error handling like, no account found or incorrect password.
If you can make another tutorial on this, then it will be really helpful
I connected this interface with a Python Flask API, and I think it's a best practice to call to your API from each Screen, using useState, helpers and whatnot.
You can have your own config.js with your endpoint URL, and then export it to your screens. That's what I did.
And if you use Expo or you struggle making requests to your API, use ngrok for echoing your local server to Internet. It's very simple to setup.
Cheers!
Can explain me how can I use redux store in my app after login using react navigation 5 with authcontext and
there is possibility I can use authcontext in different module and import to app.js file
I confuse how can I manage all auth and main app store in app
thank you for your help.
you are too good for teaching concepts.
Glad you think so!
That was a great tutorial my friend , thanks for the knowledge
This is very useful for react native custom menu. Can you please create a video for drawer navigator width submenu in react native. Thank you so much.
Hi pradip can you please demonstrate with backend data base authentication for user and token to update global state from mongo db
Thank you very much for you nice explanation.
Could you please create new video about react native and mysql connection step by step (I am new to react native).
1. Login using mysql database
2. Upload data into mysql database.
3. Displaying data from mysql database
Thank you.
Great video! Can you do a tutorial on how to implement IBM Watson services and Microsoft Azure machine learning services to react native apps? There are not many tutorials about these topics out there.
Great suggestion! I'll try to do these in future.
Thanks man
Your Videos are very Useful. Can you make a video on Mobile OTP verification in React Native?
Hi Pradip. I have a question for you: After a user logging in, how can i set the drawer menu's username to be the one captured by the authContext?
This Playlist is pure GOLD!
WOW! thanks for your appreciation.
please make a complete project tutorial using firebase, like books buying and selling app etc.
Your tutorial is really useful, thank you so much
hey im getting error after this step 18:30 and error is "can't find variable: userName" help pls?
Thanks a lot Sir! Your tutorials are helping me a lot!!
Glad to hear that
Thank you, very helpful tutorial.
Very nice tutorial 😍
Excellent job bro,Your videos are very helpful,im waiting for new videos.
Glad to hear that
Great jobs sir. It will more perfect if you combine with axios and jwt please.
Great suggestion!
You are doing great job. Please add google and Facebook auth in the series :)
I'll do it soon.
Find it very useful, Thankyou keep up the good work :)
Glad to hear that!
thanks sir , but can you make a tutorial about making app that can get location info when we took a picture and marked it on gmaps? thanks a lot once again... your explaination was so easy to understand
Excellent video, thank you very much for sharing your knowledge
My pleasure!
Great tutorial, there is just one thing missing: how do you handle signup/signin errors that would occur in the backend and show them to the user with the given structure of code ? I can't find a way to pass the errorMessage in the loginState down to the signup or signin screen.
I love the app design man!
Glad you like it!
This is good brother.
But hopefully you can group well your videos in a numbered manner for those which belong to a Playlist.
You mentioned several series, upon checking I found videos are not in a clear sequence.
Btw, yoir teaching and UI are really great, keep up the good work brother.
Greetings from Tanzania 🇹🇿
Videos are organized in order, you can check it in "react navigation 5 tutorials" playlist
Pradip Debnath, sure.
I saw it; one request though, can you work on how to setup android studio from scratch with those avd, I'm very beat here.
Consider both mac & windows users.
Greetings from Tanzania 🇹🇿
Please make a tutorial on deep-linking with react native
This was fantastic. What theme/font/style are you using for VScode - I like it a lot!
Awesome Bro .. You clear my doubt Thanks
Glad to hear that
Thank you love from india.... :)
thanks so much for these tutorials , helped alot , i have a question , i working on a project but iam using SQL instead of AsycStorage , meaning my user details will be saved in sql tables
so do i need to use all those useEffect+useReducer+useMemo ,etc...???
hoping you can answer me soon , THANKS
Great content! Lots of learning from it. Thank you
Glad to hear it!
You are doing great but Please make a video to elaborate what if i use Firebase for Authentication. I have done the Authentication using firebase but i'm not able to navigate to homescreen after authentication, since i don't have Authentication token in case of firebase.
great tutorial, thanks for sharing!
Hi Pradeep,
I am trying to run your code but I am getting this 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.
Check the render method of App.
Also my react version is 16.13.1 as opposed to your 16.9.0
great explanation bro 👍👍
Sir could you please tell me how I can implement firebase with this GUI?
Subscribed! Thank you for this!
Thanks for the sub!
Your video is awesome; can you please extend it to connect to a Graphql api?
Hi Pradip, your explanations is very nice. Can you please clarify the below issue.
How to show username and password globally using useContext without asyncStorage in home.js?
You're awesome, bro! Very usefull tutorial!!
Glad it was helpful!
Thank you
Thanks a lot
can you explain why you are using react memo for the object that will be pass as context?
Thanks, great tutorial. But how can I use that state (e.g. userName) in other components?
Thank you, We learned a lot
Hi Bro, You are making awesome videos. Please create a videos for
1- Form for Create, Update and Delete data
2- Displaying Json data in Datatable with full support of Filters, Pagination and sorting.
Thanks for your suggestions. I'll try to do these in future.
I have a question, if i would use instead a API call to do the login how i can write that? Thanks you
I tried this out, and it's pretty much the same as he does it except replace the lines
const userToken = String(foundUser[0].userToken);
const userName = foundUser[0].username;
with a fetch request to your server. You can then store and dispatch the token that the server returns. For me the fetch request looked like the below, where the user contains email and password. I added some conditions on the server side to send back 401 status if the username/password was invalid hence the checking of the status once I get a response back.
function fetchToken (user) {
return fetch(url + '/users', {
method: 'POST',
headers: {'Content-Type':'application/json'},
body: JSON.stringify(user)
})
.then(res => res.status > 401 || res.status == 400 ? Promise.reject(res) : res)
.then(res => res.status !== 401 ? res.json() : res.text());
}
Thanks!
thank you sir, please make tutorial role based auth admin and user :(
Thanks for your suggestion. I'll try to do this in future
Pradip Debnath, that will make this series thw most complete of them all regarding authentication flow.
Hoping you'll make it happen soon.
Greetings from Tanzania 🇹🇿
can you use firebase for storing data ??
thank you so much sir
appreciated Man
@Pradip Debnath - Great tutorial. I watched the whole series and you explained it really well. I followed and implemented all of your code until video #7 in the series. After that I added in my firebase authentication code. In the SignIn screen on the button click I call my firebase login method. Soon as I implemented that code, I keep getting this error: "Error: Rendered fewer hooks than expected. This may be caused by an accidental early return statement.
" Any ideas on how to resolve this error?
I have follwed the same step but i got an errors that is "TypeError: undefined is not an object (evaluating 'loginState.isLoading')"?
please make a video about react-native paypal integration
Great content, thank you very much... you are amazing
Glad to hear that! Thanks
Thank you for your effort!
My pleasure!
you are awsome!!!!!!
Great content, thank you man. Any chance you make video on php - mysql registration and authentication, optionally together with social registration (fb, google). I'm trying to connect mobile app with existing php backend. Thanks!!