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.

Login with LoginType.PHONE only completes the promise for the first time

See original GitHub issue

Platform: Android

firebase.login({
    type: firebase.LoginType.PHONE,
    phoneOptions: {
        phoneNumber: '+37011'
    }
}).catch(error => {
    console.log(error);
});

First time this works as expected, failing and rejecting the promise, console.log outputing the error message. Second time the promise is not rejected.

I’ve debugged this all the way to firebase.android.js, this line: var OnVerificationStateChangedCallbacks = com.google.firebase.auth.PhoneAuthProvider.OnVerificationStateChangedCallbacks.extend({

The callbacks work as expected and actually call reject(errorMessage); but for some reason after the first failure any subsequent calls will not reject the promise.

I would be willing to help in fixing this (if indeed it is a bug) but I’m pretty new to Nativescript and mobile development and not sure what the extend() call is or how to debug native code. It seems to be the root of the problem. I have tried calling the callback directly on the object returned by extend and could reproduce.

UPDATE: Isolated reproduction. Please note that it doesn’t matter if it’s a resolve or reject - it only works the first time.

reproduce().catch(console.log);

function reproduce() {
    return new Promise((resolve, reject) => {
        var OnVerificationStateChangedCallbacks = com.google.firebase.auth.PhoneAuthProvider.OnVerificationStateChangedCallbacks.extend({
            onVerificationCompleted: (phoneAuthCredential) => {
                resolve(phoneAuthCredential);
            },
            onVerificationFailed: function (firebaseException) {
                reject(firebaseException);
            }
        });

        const cbs = new OnVerificationStateChangedCallbacks();
        cbs.onVerificationFailed('something went wrong');
    });
}

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jnorkuscommented, Apr 17, 2018

I guess that would make it easier for me so sure why not!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Single-page application: Sign-in and Sign-out - Microsoft Learn
You can sign in users to your application in MSAL.js in two ways: ... APIs for which you need the user to consent...
Read more >
Handling user authentication with Remix - LogRocket Blog
Learn how to implement authentication on Remix apps and build a full-stack quote wall application with support for user authentication.
Read more >
Sync Issues : mSecure Support
Hi, Just upgraded from mSecure 4 to mSecure 5 on both my iPhone and iPad. I made an email backup from mSecure 4,...
Read more >
Welcome OneWest Bank Customers - First Citizens Bank
Taking care of customers—year in, year out—isn't just our track record. It's our promise. ... How do I log in to Digital Banking...
Read more >
User Options
user has logged into GoldMine for the first time. Once the ini is created, it will be modified each time the user exits...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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