aaronksaunders / AngularFire2-Ionic2-Facebook

Facebook Login w/AngularFire2 and Ionic2
19 stars 8 forks source link

Internal error when applay to use google #3

Open prisa1987 opened 8 years ago

prisa1987 commented 8 years ago

Hi, I'm seeing how to login with facebook and then I apply this with google too.

I run on android when

this.auth.login(creditial, config) 

I got internal error Can you help me?

numerized commented 8 years ago

Are you trying to log in from iOS, Android or Web (Ionic serve) ? Which error you've got ?

prisa1987 commented 8 years ago

Yes , I execute this command " ionic run android -l " and then login I got this Firebase failure: {"code":"auth/internal-error","message":"An internal error has occurred."}

numerized commented 8 years ago

Yes, I see.

By default angularfire2 external providers login method is not yet compatible with ionic2 cordova, the purpose of this repo is to enable the facebook login through cordova with a method that invokes cordova-plugin-facebook4, as far as I know there's no equivalent for google login at this point. I've tried to install the cordova-plugin-inappbrowser but is not triggered by angularfire2 for now. They'll probably update this very soon.

Your best bet now if you want to enable google provider is to use : https://github.com/nraboy/ng2-cordova-oauth

But I haven't tried it yet, but I'll definitely give it a go in a couple of hours.

hugomosh commented 7 years ago

Any updates? Same error trying to do

GooglePlus.login({
            'webClientId': '--XXt.com',
            'offline': true
        })
            .then((a) => {
                console.log(a.serverAuthCode);
                console.log(a.idToken);
                console.log(a.email);
                console.log(a.userId);
                let credentials = firebase.auth.GoogleAuthProvider.credential(a.serverAuthCode);

                this.af.auth.login(credentials, {
                    'method': AuthMethods.OAuthToken,
                    'provider': AuthProviders.Google,
                })
                    .then((success) => {
                        console.log("Firebase success: " + JSON.stringify(success));
                        alert(JSON.stringify(success))
                    })
                    .catch((error) => {
                        console.log("Firebase failure: " + JSON.stringify(error));
                        alert(JSON.stringify(error))
                    });