Open osenel opened 6 years ago
We have same problem, Have you fixed it, Share your solutions to me Thansk :-)
Hello, I have solved the issue by using another method which is described in [https://github.com/arnesson/cordova-plugin-firebase] (I have NOT install arnesson's plugin) Here is my code:
`var VerifId;
cordova.plugins.firebase.auth.verifyPhoneNumber(EnteredPhoneNum).then(function(verificationId) {
VerifId=verificationId;
EnterCode();
});
function EnterCode(){
SMS_code = prompt("Please enter the code in SMS ", "");
try {
var credential = firebase.auth.PhoneAuthProvider.credential(VerifId, SMS_code);
}
catch(err) {alert("PhoneAuthProvider.credential sonrası catch error: "+err.message);}
firebase.auth().signInWithCredential(credential).then(function(error){ alert("signInWithCredential error: "+error.message); }); } `
@osenel Thanks got it <3
i have the same issue.
cordova.plugins.firebase.auth.onAuthStateChanged(function(userInfo) {
if (userInfo && userInfo.uid) {
alert("user signed in"); // THIS ALERT FIRES IN MY CASE
} else {
alert("user signed out");
}
});
function checkUser(){ // called by button
currentUserUID= firebase.auth().user;
alert("currentUserUID: " +currentUserUID); //THIS DOES NOT
}
there is an incompatibility for this plugin with the official firebase plugin.
Same issue as above- from onAuthStateChanged I get userInfo & userInfo.uid but as soon as I attempt a write I get permission denied errors (As my rules are set to write if request.auth).
Is there any work around or patch that can be implemented until this is resolved?
Hello,
I am trying to sign in with SMS on my project. My code with comments is following.
`function SendSMS(){ var phoneNumber=String(document.getElementById("inputPhoneNumber").value);
cordova.plugins.firebase.auth.verifyPhoneNumber(phoneNumber).then(function(verificationId) { SMS_code = prompt("Please enter the code: ", ""); //this async function waits until user gives an input
}); }`
The only rule for my database is authentication. After this point, I have checked whether I am signed in. I have added a listener and a function (fired by a button).
`cordova.plugins.firebase.auth.onAuthStateChanged(function(userInfo) {
if (userInfo && userInfo.uid) { alert("user signed in"); // THIS ALERT NEVER FIRES } else { alert("user signed out"); } });
function checkUser(){ // called by button currentUserUID= firebase.auth().user; alert("currentUserUID: " +currentUserUID); //UNDEFINED }`
PS: I have added the correct package name and SHA-1 in the Firebase Console PS2: I can see that new user is created at Firebase console and "last sign in time" is updated.
Thanks...