Flutter - Beyond Firebase Auth - User Roles with Firestore

  Рет қаралды 23,762

Appwriters

Appwriters

3 жыл бұрын

In this tutorial you will learn Signup user using firebase auth, save user details to firestore, manage user roles using firestore, save user device details and more tips.
Source code (github.com/lohanidamodar/fl_f...)
_______________________________________________
♥ Become a Patreon supporter: / reactbits
_______________________________________________
Repository of my UI Challenges (github.com/lohanidamodar/flut...)
Download from Play Store (play.google.com/store/apps/de...)
Download from App Store (apps.apple.com/np/app/flutter...)
** -------------------------------------------------------------------------------- **
Let's get connected
github.com/lohanidamodar
reactbits
lohanidamodar
/ lohani.damodar
/ lohanidamodar
/ lohanidamodar

Пікірлер: 99
@kikalamuofficial5865
@kikalamuofficial5865 2 жыл бұрын
Thank you been looking for this ❤️
@snoligroup
@snoligroup Жыл бұрын
hello I love what you done it's a nice tuto. hope you will continue to help others by doing more vidéos like that
@enriqueglopezsanchez
@enriqueglopezsanchez 3 жыл бұрын
Thank you. Very good video
@SeyyedNaquibAlFaruqi-ACS
@SeyyedNaquibAlFaruqi-ACS 3 жыл бұрын
thanks a lot man. You saved me.
@ahmedtarek8676
@ahmedtarek8676 3 жыл бұрын
thank you you are the best
@swayamshreemohantyvlogs8126
@swayamshreemohantyvlogs8126 2 жыл бұрын
Thanks man you are just awesome..
@appwriters
@appwriters 2 жыл бұрын
You're welcome!
@leoncoors5734
@leoncoors5734 3 жыл бұрын
Good video brother
@user-tf7te9kr8w
@user-tf7te9kr8w 3 жыл бұрын
Very thank's
@kobbydiscount2635
@kobbydiscount2635 3 жыл бұрын
Where in this project did you use the splash screen. I see it as part of your repo but I cannot see where you used it in the project. Great job done though
@vongphetphongsavath2477
@vongphetphongsavath2477 3 жыл бұрын
Great tutorial, thank you.
@appwriters
@appwriters 3 жыл бұрын
Glad you enjoyed it!
@ravikovind
@ravikovind 3 жыл бұрын
🔥♥️
@gaspargiddson5060
@gaspargiddson5060 3 жыл бұрын
how can i add name on my Map data
@leoncoors5734
@leoncoors5734 3 жыл бұрын
What if you want your Home Screen on your main dart to be your splash page? How would you make the first screen your splash page but still get user data from the main screen?
@appwriters
@appwriters 3 жыл бұрын
Best implement some state management to do it properly. Check my flutter firebase starter ( github.com/lohanidamodar/flutter_firebase_starter )
@WikkiOnIlluminati
@WikkiOnIlluminati 2 жыл бұрын
Could you please update the description of this video to show timestamps for chapters of your video?
@victorlongoro4574
@victorlongoro4574 3 жыл бұрын
hellow sir , can you make a video using using getx with role based, its bit challenge out here
@Yusuf-rh6sj
@Yusuf-rh6sj 3 жыл бұрын
Thx from Turkey
@appwriters
@appwriters 3 жыл бұрын
Thank you too! for your support
3 жыл бұрын
oo topram
@anugrahkorambeth431
@anugrahkorambeth431 3 жыл бұрын
Hello, great tutorial. I was wondering if this way of roll based checking would have any sort of security issues, also, can you do a roll based video using firebase custom tokens?
@appwriters
@appwriters 3 жыл бұрын
If you apply the same role based checking as well in the Firestore Security rules, then there should not be any security issue.
@urdupuzzle9438
@urdupuzzle9438 3 жыл бұрын
I want to assign roles to a different user I am developing an app in which there are 15 admins so how can I do that like as in the video you used the if-else statement that if the role is admin then return AdminPage now I want to add more admins so should I used another if-else statement
@appwriters
@appwriters 3 жыл бұрын
What do you mean? Even if you add 1000 admins, only one will login at a time, and when a admin logs in, it will simply work whether it's first admin or the 1000th admin. If that's your question. If not please be more clear with your question. Thank you for watching my videos.
@urdupuzzle9438
@urdupuzzle9438 3 жыл бұрын
@@appwritersThankyou for replying. In my app, there is an Auditorium booking system, VC Appointment System, and Cafe Details . Now the above three system handle by three different users means when someone wants to meet VC he can request to the VC Personal assistant that I want an appointment the assistant send a message to the user that your appointment is fixed. Similarly, for Auditorium booking and the Cafe manager add the items so the user can see the items and price of food now I want to show auditorium admin to his page and for VC admin and cafe manager so how would I do that.
@urdupuzzle9438
@urdupuzzle9438 3 жыл бұрын
how to assign multiple roles like if there is more than one admin then we should use else if or something else??
@appwriters
@appwriters 3 жыл бұрын
Not sure if I understand your query fully. If you want to assign multiple roles for same user you can use Array (roles: super_admin,admin,customer) or you can use multiple boolean fields like (super_admin: true, admin:true, customer:true).
@urdupuzzle9438
@urdupuzzle9438 3 жыл бұрын
@@appwriters I want to assign roles to a different user I am developing an app in which there are 15 admins so how can I do that like as in the video you used if-else statement that if the role is admin then return AdminPage now I want to add more admins so should I used another if-else statement
@neteshpaudel724
@neteshpaudel724 3 жыл бұрын
Hey brother, Just watched the video and looks like I manually had to provide the role . Is there any way to differentiate user like normal user and admin at the time of authentication like by adding another screen where I can ask user about role and authenticate it with some kind of pass/code ,I had use google auth for this . Is it possible? If yes then how ? Or Is there better way to do that ?
@mpr2801
@mpr2801 3 жыл бұрын
@Netesh Paudel Did u got d solution for that
@neteshpaudel724
@neteshpaudel724 3 жыл бұрын
@@mpr2801 no brother
@sgouri3519
@sgouri3519 2 жыл бұрын
I have developed an app with admin But the problem is admin is going logged by the same email and password which is registered for user I want differentiate between both admin user so that admin only can log by his own email pass. How to do that
@appwriters
@appwriters 2 жыл бұрын
From what I understand, There might be two ways, server side claims and roles in firestore, firebase.google.com/docs/firestore/solutions/role-based-access I have a tutorial here that is a bit old but might help you understand roles in firestore. kzfaq.info/get/bejne/d5Z2oZihzKq4nmQ.html
@pulscare6272
@pulscare6272 3 жыл бұрын
you are love. solved my big problem. ThankYou soo much.. how to save "name" in database throuh signup
@appwriters
@appwriters 3 жыл бұрын
Same as any way you save any other value, you can update once the user is created to store the name or update on firebase auth and database as well.
@pulscare6272
@pulscare6272 3 жыл бұрын
@@appwriters Thankyou.
@adnankitabi9530
@adnankitabi9530 3 жыл бұрын
@@appwriters bro getting null for name while doing creating an account. Is it possible to pass name which user provides in sign up form to our firestore db? I struggling with this for 3 days now. If yes, which dart file needs to be updated Thanks
@jayamuruganj5091
@jayamuruganj5091 3 жыл бұрын
pls make the video for the admin only create the users that means admin must create the user,user role,remove the user, update user position
@richpo9814
@richpo9814 3 жыл бұрын
Firebase Auth made updates for October. There were lots of changes made. Firebase Auth and User. Dart now conflicts with eachother when importing.
@appwriters
@appwriters 3 жыл бұрын
I am using 0.18.1+1 and the version released is 0.18.1+2, and change-log specifies only minor change, and the code is also working fine. I am not sure what you are referring to.. If you have any issue, create a issue in github, provide proper information, code and errors
@dileepdilraj5254
@dileepdilraj5254 3 жыл бұрын
Read documents in official flutter website there are very few commands only changed and that more easy access commands
@amitbairwa7016
@amitbairwa7016 3 жыл бұрын
i need to implement the same process in my app but I m using phone authentication instead of email/password. can you help me out with what changes should I make?
@appwriters
@appwriters 3 жыл бұрын
If you can make phone auth work, then only thing to do is in firestore save by phone number. everything else should be the same.
@amitbairwa7016
@amitbairwa7016 3 жыл бұрын
@@appwriters where to save by phone number and how? I m very much new to flutter and non-tech background. my phone auth is working fine. I just copied your code and tried to make it work mine. but I am unable to create stream builder for auth change. please look into it. thanks for reply.
@jayamuruganj5091
@jayamuruganj5091 3 жыл бұрын
pls make the video for the admin only create the users
@pulscare6272
@pulscare6272 3 жыл бұрын
if i want show all admin in user_home_page.. what code should i write for this??
@appwriters
@appwriters 3 жыл бұрын
I am not sure I understand your question?
@pulscare6272
@pulscare6272 3 жыл бұрын
@@appwriters want to show all admin list in user's home page.
@alanoodalmaari8106
@alanoodalmaari8106 3 жыл бұрын
When I press on login it does not take me to the another page still in log in page
@appwriters
@appwriters 3 жыл бұрын
You should please compare your code to the code in the repository!
@urdupuzzle9438
@urdupuzzle9438 3 жыл бұрын
In my app, there is an Auditorium booking system, VC Appointment System, and Cafe Details . Now the above three system handle by three different users means when someone wants to meet VC he can request to the VC Personal assistant that I want an appointment the assistant send a message to the user that your appointment is fixed. Similarly, for Auditorium booking and the Cafe manager add the items so the user can see the items and price of food now I want to show auditorium admin to his page and for VC admin and cafe manager so how would I do that.'
@appwriters
@appwriters 3 жыл бұрын
That means they all are not same admin, they all have different role, so you have to handle separately.
@urdupuzzle9438
@urdupuzzle9438 3 жыл бұрын
@@appwriters How to handle it. Can you give me some guideline please I need this?
@1stplace362
@1stplace362 2 жыл бұрын
bro did you find a solution
@urdupuzzle9438
@urdupuzzle9438 2 жыл бұрын
@@1stplace362 no
@luzgenesis7
@luzgenesis7 3 жыл бұрын
I have a problem in a main.dart when i logged => " The method '[]' was called on null. Receiver: null Tried calling: []("role") "
@appwriters
@appwriters 3 жыл бұрын
Compare you code with the code in the github repository.
@doctork2579
@doctork2579 3 жыл бұрын
did u got the solution ? please help because i stack to this also
@luzgenesis7
@luzgenesis7 3 жыл бұрын
@@doctork2579 tell me if it works for you
@emirhan6134
@emirhan6134 3 жыл бұрын
I think it's because of your login page doesn't send user to any screen. Try to use navigator to go your main screen and if user can go main screen successfully then it will add datas to your Firestore Cloud.
@paulinezipagan2136
@paulinezipagan2136 Жыл бұрын
upp! can someone help? what's the solution for this?
@eduardomelato5147
@eduardomelato5147 3 жыл бұрын
if I log out and then log in with a admin account i get to the non-admin home page
@appwriters
@appwriters 3 жыл бұрын
Compare you code to the Code in the Repo linked in the Description.
@tobiasmiklavcic2211
@tobiasmiklavcic2211 3 жыл бұрын
Hi Damodar, first of all THANK YOU for both great videos about User Roles and Login. Your videos are from around 8 month ago and maybe because of changes in the meantime I receive errors in main.dart and admin_home.dart. Maybe you can help about what changed in Flutter version. My errors belong to "if (user['role'] == 'admin') {" and error message says: "The operator [] isn't defined for the type Object. Try defining the operator '[]'". There is in Andoid Studio a red waveline under ['role'].
@appwriters
@appwriters 3 жыл бұрын
With changes in dart language like null safety and other improvements, these errors are coming. you can make `user['role']` to `(user as Map)['role']`. You need to explicitly define types and it should work.
@mpr2801
@mpr2801 3 жыл бұрын
Have u corrected your error Even i am.getting d same error
@mpr2801
@mpr2801 3 жыл бұрын
@@appwriters What are the changes that we need to make if we get the above error
@jimbansuela6515
@jimbansuela6515 2 жыл бұрын
hey if you are still having this error just remove the " .data()" in "snapshot.data.data()"
@danishdarren1179
@danishdarren1179 3 жыл бұрын
do you have any video on cloud firestore, refrerece data type
@appwriters
@appwriters 3 жыл бұрын
Sorry, not yet. Might be a nice addition.
@danishdarren1179
@danishdarren1179 3 жыл бұрын
@@appwriters If u could explain it, it'd be helpful, coz there aren't many explanatory videos on that, the way you do, Love from Maharashtra ❤️
@luzgenesis7
@luzgenesis7 3 жыл бұрын
if i just want hide some widgets in home page just for users how can i do it? thanks for the video !!
@nepalicloud
@nepalicloud 3 жыл бұрын
u can use visibilty widget and its has Visiblity{child:container(),visiblity:user.isAdmin = = true ?true : false;}
@appwriters
@appwriters 3 жыл бұрын
You can simply do these with conditionals (if or ternary operator by checking on the value of user or any other field that you want to base the visibility on)
@nepalicloud
@nepalicloud 3 жыл бұрын
@@appwriters sir , in app coin banauda nepal ma legal xa just for internal app transaction only
@appwriters
@appwriters 3 жыл бұрын
@@nepalicloud If that coin is only in APP and doesn't translate to real world physical cash, I think it's safe from any legal obligations of Nepal government.
@appwriters
@appwriters 3 жыл бұрын
@@nepalicloud It should basically be like reward points ?
@jcperez7925
@jcperez7925 2 жыл бұрын
is there an updated version of this video?
@appwriters
@appwriters 2 жыл бұрын
Sorry, no, but most of the concepts should work in any version
@pulscare6272
@pulscare6272 3 жыл бұрын
want to show all admin list in user's home page.
@appwriters
@appwriters 3 жыл бұрын
It's just querying the Users collection and displaying the list
@akshaybhadauria4765
@akshaybhadauria4765 2 жыл бұрын
Can you please make a video on role based using react and firestore
@appwriters
@appwriters 2 жыл бұрын
Sorry, not doing react for quite some time now, But if you understand roles here, it should be similar to how you implement in react
@urdupuzzle9438
@urdupuzzle9438 3 жыл бұрын
How to handle it. Can you give me some guideline please I need this?
@appwriters
@appwriters 3 жыл бұрын
Multiple if-else or switch statement
@ExtraServingsBTS
@ExtraServingsBTS 3 жыл бұрын
You can't handle it.
@urdupuzzle9438
@urdupuzzle9438 3 жыл бұрын
@@ExtraServingsBTS then what to do
@ExtraServingsBTS
@ExtraServingsBTS 3 жыл бұрын
@@urdupuzzle9438 start by watching 'A Few Good Men'
@Bl4kRobbie53
@Bl4kRobbie53 3 жыл бұрын
if you can make a video "how to create a profilepage and update dataprofile", i think i come to your house i bring you a italian pizza
@basspalace2920
@basspalace2920 3 жыл бұрын
Yo......you look like a bald Tekashi69.....dope tutorial though. I definitely needed this.
@appwriters
@appwriters 3 жыл бұрын
Thank you!
@roshanjungkunwar8440
@roshanjungkunwar8440 3 жыл бұрын
you from Nepal bro ?
@appwriters
@appwriters 3 жыл бұрын
Yes! Why bro?
@roshanjungkunwar8440
@roshanjungkunwar8440 3 жыл бұрын
@@appwriters i was just wondering on your name so
@Dima-qz4su
@Dima-qz4su 2 жыл бұрын
cuntinue ;)
@leloughlemperough1903
@leloughlemperough1903 3 жыл бұрын
thanks a lot man. You saved me.
@appwriters
@appwriters 3 жыл бұрын
Awesome! good to hear!
How to Handle Firebase Authentication in Flutter with Riverpod
35:39
Looks realistic #tiktok
00:22
Анастасия Тарасова
Рет қаралды 106 МЛН
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
МЯТНАЯ ФАНТА
Рет қаралды 10 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:40
CRAZY GREAPA
Рет қаралды 9 МЛН
Handling user roles is not that simple on Next.js using Firebase.
52:01
Flutter - Role-based authorization with Firestore
25:41
Raja Yogan
Рет қаралды 43 М.
[Flutter] Firebase Authentication Using Riverpod
1:48:13
Watery Desert
Рет қаралды 10 М.
LOGIN APP • FLUTTER - BLOC & FIREBASE Tutorial for Beginners 🔥
1:45:45
Flutter RBAC (Role Based Access Control)
11:28
ExtraServings BTS
Рет қаралды 5 М.
Firebase Auth Tutorial #15- Firestore Users Collection
12:54
Net Ninja
Рет қаралды 287 М.
Looks realistic #tiktok
00:22
Анастасия Тарасова
Рет қаралды 106 МЛН