question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FR: createUser by specify providerID (facebook.com, google.com)

See original GitHub issue

I am currently using passportjs with Node.js in firebase functions to create authentication. The problem is I used Facebook authentication. However when I create account using the following command. It still creates account by email only. There is no provider if I check in console.

admin
        .auth()
        .createUser({
          email: profile.emails[0].value,
          emailVerified: false,
          displayName: profile.displayName,
          photoURL: profile.photos[0].value,
          disabled: false,
          providerData: [
            {
              displayName: profile.displayName,
              email: profile.emails[0].value,
              photoURL: profile.photos[0].value,
              providerId: 'facebook.com',
              uid: profile.id
            }
          ]
        })

And when I try to sign-in from client side by Facebook with the same email. I cannot sign in since there is email existing in Firebase Authentication. On the other hands, if I create account from Client Side App by Facebook. I cannot create admin.auth().createUser({ … }) with the same Facebook email.

I think it happen because. The account is no linking together if we create account by Firebase Admin.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bojeil-googlecommented, Oct 23, 2017

Hey @JochenDB, we don’t have a timeline for this. I will keep this post updated when I have an update. Most developers only need this feature for migration purposes and the CLI SDK is sufficient for that. That said, we will still support this.

0reactions
RobertoAyala2112commented, Jan 14, 2019

Same problem here, facebook users get an empty provider image in Firebase Console and cant singIn. I dont get errors when I run my code.

My testing code:

var userImportOptions = {
    hash: {
        algorithm: 'HMAC_SHA256',
        key: Buffer.from('secretKey')
    }
};

admin
    .auth()
    .importUsers([{
        uid: 'asd123',
        firstName: 'Roberto',
        lastName: 'Ayala',
        email: '2112ayala@gmail.com',
        picture: 'https://graph.facebook.com/10214464120199982/picture?height=250',
        emailVerified: true,
        providerData: {
            displayName: 'Roberto Ayala',
            email: '2112ayala@gmail.com',
            photoURL: 'https://graph.facebook.com/10214464120199982/picture',
            providerId: 'facebook.com',
            uid: '10214464120199982'
        }
    }], userImportOptions)
    .then(function(userImportResult) {
        console.log(userImportResult.successCount);
    })
    .catch(function(error) {
        console.log(error);
    });

screenshot 3

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authenticate Using Facebook Login with JavaScript - Firebase
On the Sign in method tab, enable the Facebook sign-in method and specify the App ID and App Secret you got from Facebook....
Read more >
Google, Facebook, Phone, Email & Password Sign Up | Provider
Learn about Firebase Authentication with Flutter that includes Email/Password Signup & Login, Google Sign In, Facebook Sign In, ...
Read more >
sucessfuly retrieving token but it appears null when passing it ...
I have set up my app so that I can log into Facebook successfully and retrieve ... credential === AuthCredential(providerId: facebook.com, ...
Read more >
Creating an Account | Facebook Help Center
We'll be adding updated instructions to the Help Center for features that are available on mobile ... Tap Female, Male or Custom to...
Read more >
User | React Native Firebase
The authentication provider ID for the current user. For example, 'facebook.com', or 'google.com'. providerId: string; ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found