How to make an entrance with custom fields for sign in to Google account - flutter

I work at flutter.
I have a task when the user gets to the login page, he should see the login password field and enter their data (as in the picture), and not the button that offers google-button I found some examples but there is also no this, please tell me if there is such an option as it can be through the API to log in.
and in the future, I will need to work with the Google calendar.
https://developers.google.com/apps-script/reference/calendar/calendar#createAllDayEvent(String,Date)
https://medium.com/flutter-community/flutter-implementing-google-sign-in-71888bca24ed
https://pub.dev/packages/google_sign_in
https://developers.google.com/identity/sign-in/android/sign-in

I'm confuse if you don't want to offer the user to use google sign in don't use it then. You can use Firebase Auth instead to sign in with email and password like this:
await FirebaseAuth.instance.signInWithEmailAndPassword(
email: txtEmail.text,
password: txtPassword.text,
);
It will check from FirebaseAuthentication on your Firebase Project whether the user already register with email and password in your database, so the user will be listed there with flag email instead of google, but if the user whom register with google reset their password which will apply to your apps only not their account they will get flag email and google.
So I suggest you make register page and then use the FirebaseAuth method:
FirebaseAuth.instance
.createUserWithEmailAndPassword(
email: txtEmail.text, password: txtPassword.text)
Then the user will be listed in Authentication and they can login with email and password

Related

Flutter iOS sign in with apple not showing email after revoking token

With the apple user deletion policy
Apps that support account creation must also offer account deletion to give App Store users more control of the data they've shared while using your app.
I successfully refresh and revoked the token with the apple id and deleted the user from firebase.
But when deleted user tried to login again using Sign in with apple it's not showing email or username. When user sign in with apple account I am creating a user in firebase, for the first time is working good, when user deleted their account and tried to logged-in again the email is empty.
I am using the below code to retrieve email and name for the logged in user.
// Request credential for the currently signed in Apple account.
final appleCredential = await SignInWithApple.getAppleIDCredential(
scopes: [
AppleIDAuthorizationScopes.email,
AppleIDAuthorizationScopes.fullName,
],
nonce: nonce,
);
same error with me, get email with first time signing but after that don't get email and receive null.
I fount this solution enter link description here But not the best solution, If you find a solution, please reply here.

iOS/Swift - How to verify a user's email with Firebase WITHOUT using it for auth?

(Swift/SwiftUI - iOS) My app allows authentication via firebase auth with phone number. Users can optionally add their email address in the preferences page of the app (to receive marketing emails, not for authentication).
Does anyone know if I can use firebase a cloud function to verify these user emails but NOT use them for auth? I can already save the user email to firestore, I just want to know if there is a way for firebase to email the user to confirm the email, then e.g. write a verified boolean value to firebase.
I know I can verify emails with firebase auth but these users did not sign up with email and have no password. I also don't want to overwrite their phone number as primary signin method for firebase auth as I am not supporting login with username/password.
You can set the emailVerified property through the Admin SDK, which is indeed what you'd use in Cloud Functions. If you look at the documentation on updating a user, you'll find this sample of how to do this:
getAuth()
.updateUser(uid, {
email: 'modifiedUser#example.com',
phoneNumber: '+11234567890',
emailVerified: true, // 👈
password: 'newPassword',
displayName: 'Jane Doe',
photoURL: 'http://www.example.com/12345678/photo.png',
disabled: true,
})

is there a way to reset a password via email without firebase auth in flutter

In case a user forgot their password, how can I send them an email to reset it without firebase authentication?
As in they receive an email with a link that takes them to a page/webpage where they can reset their password and confirm the change, then they can login with their new password.
Assuming you are using Firebase Auth in your app: I don't know what you mean by "without firebase authentication?" That's not possible, but perhaps you mean through a specific means. Here are the two most common ways:
You can manually send a password reset by going into your firebase dashboard, go to Authentication, find the email, and on the right of the UID a menu icon comes up when you hover..you can choose to send a password reset email.
You can call this in a flutter app FirebaseAuth.instance.sendPasswordResetEmail(email: email);

Keycloak Implement Reset password flow same as forgot password flow

I am facing an issue with Keycloak:
When user clicks on Forget password button, he is asked to enter basic details. Once details are entered, the user receives a mail with link to change his password. User Changes his password, and is redirected to Login page of the application.
Users account gets locked. Admin uses application to unlock the account. User gets email, clicks on link, and generates new password. User now sees a message : Your account is successfully updated.
What I want to do is that the second flow should work in same way as the first one. i.e when user has given new password, he'd be redirected to login page.
Can someone guide me about how to proceed with this?
Difference I've noticed in two flows is the URL that I receive in both of them is different.
First flow, I get this in mail: http://[keycloak-host]/auth/realms/[realm]/login-actions/reset-credentials?code=[code]
Second flow, I get this URL: http://[keycloak-host]/auth/realms/[realm]/login-actions/execute-actions?key=[key]

How to Link Multiple Auth Providers to an Firebase Account?

I am unable to to sucessfully to do , I followed the following steps as instructed on Firebase Docs:
Signed in use using existing auth provider(my case:facebook).
Complete the sign-in flow for the new authentication provider up to, but not including, calling one of the Auth.signInWith methods.(my case: i want to link email & password and Google OAUth). So this is the step i'm unclear about, I created a new provider using var provider = new firebase.auth.GoogleAuthProvider(); and I did not do Firebase.auth().signInWithPopup(provider) .
Then to get authcredential for google I run var credential = firebase.auth.GoogleAuthProvider.credential(
googleUser.getAuthResponse().id_token); (I get an undefined googleUser error) this error seems appropriate since I have not signed in using Google Oauth but thats what the 2nd steps states(not to signin)
And then this command to link with the current user who is on a Facebook Provider auth.currentUser.link(credential)
My understanding is that currentUser needs to be linked to my existing Provider(Facebook). It seems that credential variable for google is never computed. Anyone with a functional code example would really help.
If you want to manually link a google and email/pass account to existing facebook only firebase user, you can do the following:
First, the user should be signed in to Facebook.
Link the google user:
var provider = new firebase.auth.GoogleAuthProvider();
auth.currentUser.linkWithPopup(provider);
Then link the email/pass account:
auth.currentUser.linkWithCredential(firebase.auth.EmailAuthProvider.credential(auth.currentUser.email, 'password'))
All these accounts to be linked must be new and not already linked.
#bojeil I have read your question and I found the way to log in both Google and Facebook logins having the same email account. First, in the Firebase, you need to allow
"Multiple accounts per email address"
Allow multiple accounts per email address
Now you can log in with both Facebook having "xyz#gmail.com" & Google having the same email name as "xyz#gmail.com".But you will encounter the email as "null" for the second login having the same email. You can get over the null problem by using the below snippet.
Just use this snippet in on success task from the firebase:
Map profile = task.getResult().getAdditionalUserInfo().getProfile();
Object email = profile.get("email"); /// Obtaining the email from the use though we use same email form facebook and Google log in accounts.
By this way, you can log in into both Facebook and Google logins using the same email.
I hope you got your doubt cleared with this info. Can you please get back to me if this suits your question?.
Thank you.