mikkopaderes / ember-cloud-firestore-adapter

Unofficial Ember Data Adapter and Serializer for Cloud Firestore
MIT License
69 stars 17 forks source link

Issue signing in with firebase "auth.signInWithPhoneNumber" #113

Closed alexmasita closed 4 years ago

alexmasita commented 4 years ago

Hi @mikkopaderes. Hope you are keeping safe.

This is not so much an issue with this addon perse but a request for assistance. You have exposed the firebase API for sign in with email and password but I am struggling to enable "signInWithPhoneNumber". Would you be able to give me some pointers on this? I tried to follow the firebase authentication documentation to no avail.

I have created a repository with a working implementation of your "auth.signInWithEmailAndPassword" here: git clone https://alexmasita@bitbucket.org/alexmasita/kenya.united.git.

It is a public repo. I have implemented the sign-in method in the "sign-in" component which works. You can also see the commented sections where I tried to implement the "signInWithPhoneNumber". The error I kept getting was on the following code:

//Predicated the firebase handle with this. as you have exposed it as service in your library.
window.recaptchaVerifier = new this.firebase.auth.RecaptchaVerifier('sign-in-button', {
  'size': 'invisible',
  'callback': function(response) {
    // reCAPTCHA solved, allow signInWithPhoneNumber.
    onSignInSubmit();
  }
});

Specifically, I was getting new this.firebase.auth is not a constructor. I tried to change it to new this.firebase.auth(). to include the opening and closing braces but it was throwing a different error that says something like cannot call bind of undefined which seems to be thrown inside the vendor/fastboot-shims/firebase/firebase-app.js

Let me know if you can help.

mikkopaderes commented 4 years ago

I'm on my phone and haven't looked at the phone auth docs but at first glance what you might be looking for is the firebase.auth from import firebase from 'firebase'; not the one from the this.firebase service as they're two different things.

alexmasita commented 4 years ago

Hi Mikkopaderes. Thanks for this. importing the firebase like so import firebase from 'firebase'; resolves my issue. I am going to go ahead and close this issue. Thank you.