Giter VIP home page Giter VIP logo

Comments (9)

cairin avatar cairin commented on July 17, 2024 1

Eureka🎉 I found the solution in the docs.

the maximum amount of time you are willing to wait for SMS auto-retrieval to be completed by the library. Maximum allowed value is 2 minutes. Use 0 to disable SMS-auto-retrieval. If you specifies a positive value less than 30 seconds, library will default to 30 seconds.

Thank you for your help!

from cordova-plugin-firebase-authentication.

cairin avatar cairin commented on July 17, 2024

And onAuthStateChanged is never called.

from cordova-plugin-firebase-authentication.

DiegoParadeda avatar DiegoParadeda commented on July 17, 2024

@cairinmichie I had a similar situation to yours.
The first thing I did when looking up this plugin was looking for "onAuthStateChanged" inside it but I also couldn't find it. Still I added this plugin and "whitelist" plugin to my project and it worked.
I used phonegap to compile it but also did it from framework 7 using GUI bash. To do that either add the plugin one line declaration to you config.xml file (in this case I added to the one in root folder AND the config.xml in www folder) and the compiler will add the rest of the files for you.
Another way of adding them is through "cordova plugin add cordova-plugin-firebase --save" in your command line aiming for the root folder of your project.
Good luck!

EDIT: "cordova plugin add cordova-plugin-firebase --save" works for the framework 7 bash declaration I mentioned which I guess uses a more raw version of cordova and for that reason won't work if you're using phonegap.

from cordova-plugin-firebase-authentication.

cairin avatar cairin commented on July 17, 2024

So my problem is that I want to login using js, and not in the platform code. I was using this workaround. But that doesn't work on v1.0.1 anymore because verifyPhoneNumber isn't really supported as far as I can tell.

So I've resorted to using v0.13.2 because verifyPhoneNumber still works there. However this means I can't use the latest versions of @chemerisuk other plugins because of dependancy problems with cordova-support-google-services. So I'm kinda stuck at the moment.

from cordova-plugin-firebase-authentication.

chemerisuk avatar chemerisuk commented on July 17, 2024

@cairinmichie Have you registered the onAuthStateChanged callback?

from cordova-plugin-firebase-authentication.

cairin avatar cairin commented on July 17, 2024

Yes, that still doesn't support my use case though? Unless I'm missing something? Correct me if I'm wrong, but there's no way to send an sms if the Android auto-verify has been used?

from cordova-plugin-firebase-authentication.

chemerisuk avatar chemerisuk commented on July 17, 2024

try to use this function:

function verifyPhone(phoneNumber) {
    return new Promise(function(resolve, reject) {
        const firebaseAuth = cordova.plugins.firebase.auth;

        firebaseAuth.onAuthStateChanged(resolve);

        return firebaseAuth
            .verifyPhoneNumber(phoneNumber).then(function(verificationId) {
                const smsCode = prompt("Enter SMS code");

                return firebaseAuth
                    .signInWithVerificationId(verificationId, smsCode);
            }).catch(reject);
    });   
}

like below:

verifyPhone("+1234567").then(function() {
    console.log("phone was verified");
}).catch(function(err) {
    console.error("verification failed", err);
});

from cordova-plugin-firebase-authentication.

chemerisuk avatar chemerisuk commented on July 17, 2024

there's no way to send an sms if the Android auto-verify has been used?

Yes, no way at present. But why do you need this?

from cordova-plugin-firebase-authentication.

cairin avatar cairin commented on July 17, 2024

My problem is this:

I use vuexfire extensively throughout my vuex store. Vuexfire requires that you use the firebase js library for authentication, as far as I'm aware. So I was using the signInWithVerificationId function to login my users with the js library rather than android/ios. I'm not sure there is a way to accomplish logging in with the js library when using onAuthStateChanged.

from cordova-plugin-firebase-authentication.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.