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.
Related
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.
Does Firebase count the getting current user id or email (Auth.auth().currentUser?.uid , Auth.auth().currentUser?.email) as a read operation and charge it? I searched the documentation but could not find any information.
No, there is no charge associated with getting current user id or email or any kind of auth information. Firebase auth is completely free except the phone auth. You can have unlimited number of users in Firebase Authentication with email, Google, Microsoft etc.
The charge with reference to the read operations is for Firestore. It is totally separate 'module' than Authentication.
The code you're showing is just working with Firebase Authentication, which does not have any billing associated at all for its API, except for use of phone authentication. This should be clear from the documentation on pricing.
I'm trying to create a demo account for my app, so that I can submit it to the iOS App Store. The app requires that your email be verified before you can use it. However, the verification emails are not coming into my demo#xxx.xxx inbox, and so I cannot verify the account. Is there any way I can manually set that firebase account as verified?
Thanks
This works as a cloud function.
I add the userid as a key to a child called force with any value and it triggers this function that authenticates the email.
you also must include
const admin = require('firebase-admin');
cloud function
exports.forceQue = functions.database.ref('/force/{uid}').onWrite((data,context) => {
if (!data.after.exists()) {
return false;
}
const uid = context.params.uid;
admin.auth().updateUser(uid, {emailVerified: true});
return true;
});
Firebase Authentication doesn't have an API to set the verification status of an email address.
The Firebase Admin SDK (which should only be run on a trusted environment, such as a machine you control) can set this flag. See this documentation section for an example.
But unless you're submitting apps on behalf of the users of your app, shouldn't the email address just be your usual (real) mail address?
if you mean adding an email on your firbase to have access as a user to the app then you can do that as per the picture
Situation:
User A registers an account in our application and logs in.
For what ever reason logs out.
Logs in to the application again using Facebook social sign on with an account that has the same email associated with it as the
original registration had.
A second account is created for this sign on and 2 accounts exist in the system.
How can I merge these accounts into a single account during the social sign on (by querying for the existence of that email) automatically or with User Collection Business Hooks (if with business hooks, can you please provide an example of how I would do this as documentation online is unclear for this specific purpose).
Notes:
Kinvey backend
Phonegap with facebook plugin
Jquery mobile
Wish to merge accounts or find existing account and add social identity to it during sign on
Assume I cannot delete users
Preferably achieve this step with a PreSave Kinvey Business Logic Hook
Cheers,
I managed to create my own custom end point to basically achieve user merging.
If a user exists with a kinvey account, then tries to log in using facebook with an email address matching a kinvey user, I used the following end point code to add a social identity to the existing user before attempting to log in using that user (This function only worked because we maintain a guest login for users not logged in to the system).
Hope this helps some one.
function onRequest(request, response, modules) {
var users = modules.collectionAccess.collection('user');
var social = request.body.social;
users.findAndModify({"username":request.body.email},{$set:{"_socialIdentity":social}},
function(err,result){
if(err){
response.error(err);
response.complete();
}else{
if(!result._id){
response.body = {message:"No User Found Matching This Email"};
response.complete();
}else{
response.body = {message:"User Was Hopefully Updated"};
response.complete();
}
}
});
}
I'm trying to resubmit my website to Google AdSense and it's giving the following error again and again:
A user with the email you specified
already exists Please select a
different Google Account login to
access this account.
How to resolve this issue?
I have changed my password, recovered it but still not working.
You could try logging in to the account associated with the email address you are trying. It sounds like you're trying to create an account using an email address that you have already used to create a different account.