Is it possible to show different UI according the user sign in Firebase(Admin UI/User UI) - flutter

I want to show different UI according to the user sign-in. if the user signs in with the user email app will navigate to the user page. and if the admin signs in with the admin email app will navigate to the admin page. How can I achieve this in Firebase
I don't want to validate in the frontend

First check if the user is loggedIn or not
-> If logged in :
-> Fetch User data from Firestore then
Scaffold(body:(user.role == 'Admin')? AdminView(): UserView())

Related

How to allow user to save/fill login info on/from Keychain/Keystore in Flutter

What I want to achieve
Save login credentials (email and password) on Keychain/Keystore.
Fill login form when a user selects corresponding login info from Keychain/Keystore just like attached with some hints shown above keyboard. Example behavior from https://stackoverflow.com/questions/67582718/save-login-info-to-apple-keychain-in-flutter
Being able to delete the credentials from Keychain/Keystore directly when a user wants to.
What I have tried
I have been successful saving and fetching email and password using flutter_secure_storage, but I cannot locate where they are on Keychain. I want to set domain or app bundle id or something to let Keychain/Keystore know that the credentials are for this app, but I cannot find such settings on flutter_secure_storage.

How to get user details when authenticating with social sign in with Flutter?

I am in the middle of creating a Flutter application and am stuck on how to implement authentication using email/password and social providers like Google and Facebook. Everything works except my approach on how to get user details to store in Firebase like address, phone number, username, etc. Implementing this when working with email/password registration has been simple because I created a multi screen form and then finally registered the user which would log them in. The problem with getting additional details when working with social providers is that I would need to authenticate the user first before ever getting the chance to get additional details. How can I go about getting user details for users that choose to use Google and Facebook to authenticate?
One way is to prompt the user to enter the required additional details when the user logs in.
You should first check if the user logged in through a Social Media provider :
List<String> providerList = await FirebaseAuth.instance.fetchSignInMethodsForEmail(_email);
fetchSignInMethodsForEmail will return a list of sign providers the user used to login to your app (if you haven't enabled account linking, this would probably be just one provider)
Here's a list of social media provider ID's :
GoogleAuthProviderID: google.com
FacebookAuthProviderID: facebook.com
TwitterAuthProviderID: twitter.com
GitHubAuthProviderID: github.com
AppleAuthProviderID: apple.com
YahooAuthProviderID: yahoo.com
MicrosoftAuthProviderID: hotmail.com
For example, if you have enabled Facebook login, you can check if the 'facebook.com' is available in the providerList, if so prompt a screen to collect your additional data and update your user record on Firestore for this user.

Login to Facebook from another application

I have a windows application. Users will login to my windows application. Once logged in, there will be a button as "Login to Facebook". The logged in users username and password for facebook is already stored in my DB and i can retrieve that information.
What I need is, once the user clicks on the "Login to Facebook" button, it should automatically go to facebook page with the User logged in by providing the Username and Password retrieved from my DB.
If this is not do-able, upon clicking the button, it should open the facebook login page and enter the Username and Password values retrieved from DB in their relevant textboxes.
This is a research project for my studies. Appreciate your help on this.
You need to go through the following to understand the facebook's login flow
https://developers.facebook.com/docs/facebook-login/web
For manualy building the login flow go through this
https://developers.facebook.com/docs/facebook-login

How to login using FaceBook test users (created from the facebook developer app roles page)

Is it possible to login to facebook directly (facebook.com) using the test user account created using the Facebook Developer app feature (Roles / Create test users)? What password should I use? I understand we can use the "Switch to " option after logging in as myself to facebook, but I want to be able to login directly using the test user accounts, so that I can provide these user details for other testers who do need to use their personal facebook account in any way related to the testing of the application.
Yes, we can login directly facebook(facebook.com) with test user accounts.
Step 1
Create test user by clicking Add button
Step 2
Click Edit button where have all option
Change name
Set Password
Generate access token etc.
You can simply change the password of the Test User by issuing a POST request to this URL
https://graph.facebook.com/TEST_USER_ID?password=NEW_PASSWORD&name=NEW_NAME&method=post&access_token=APP_ACCESS_TOKEN
Then you can give other people the account info of that user with the newly set password and they can log in to Facebook as that user.

Facebook Login/Register with my database

I have a website with my custom register system (really simple - username, password and e-mail).
I want to make Login with facebook as my new and only register/login system.
I want to put a login button which:
- if user is logged to facebook just asks for permission to use e-mail and other data + asks for custom username
- if user is not logged, then just facebook login
Then the user would not need to login to my page if he's logged in to Facebook.
Can you please give me a hint or suggest a framwork to do this with?
If you look on the Facebook developers page it tells you how to do this
https://developers.facebook.com/docs/guides/web/#login