angularfire: auth.login() Error "location.protocol" must be http or https
auth.login()
has an error when attempting to authenticate with Google or Facebook on an iOS or Android device using Cordova.
Here is a code sample:
this.af.auth.login({
provider: AuthProviders.Google,
method: AuthMethods.Popup
}).then((value) => {
//success
}).catch((error) => {
console.log(error);
});
Running version 2.0.0-beta.3-0930330
of angularfire2.
When run in a Cordova app the error callback will be called with this message:
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 5
- Comments: 55 (7 by maintainers)
does it make sense to add some
Help Wanted!
or other label to raise the importance/severity? looks like this is actually a blocker for ionic/phonegap apps.I don’t know who is developing AngularFire2 but the problem is on the Firebase side.
I contact the Firebase team and this the answer: Are you using popup / redirect sign in methods in Firebase 3.x.x? If so, these methods are currently not supported in native Ionic/Cordova apps. Sorry about that. As a workaround, I recommend to use a library for OAuth such as ngCordova(in Cordova and Ionic apps) and then use auth().signInWithCredential(…) to sign your users in.
@Lindstrom1989 @jgw96 This solution using ionic-native facebook plugin to get the accessToken, creates the credential and then successfully logs in using angularFire2 https://github.com/aaronksaunders/basicaf2
some news?
https://market.ionic.io/starters/firebase-v3-auth-social-kit-2 This solved my problem completely
https://javebratt.com/ionic-social-login-firebase/ Follow this guide…It worked for me
Some news?
Some news?
signInWithRedirect seems to have the same issue than signInWithPopup()
@edzillion the method signInWithPopup don’t work with cordova/ionic, you should use the signInWithRedirect method.
@Chuckv01 thx for the quick reply.
I was not able to make this plugin working with ionic 2. I’ve only found examples that uses angular 1 not angular 2, so i was not able to import the right module to get the plugin to work.
If someone manage to get ionic2 working with angularfire2/firebase google auth and could post a little piece of code, i would appreciate it
@aaronksaunders thanks for the solution, but in my project here i’m not able to use facebook auth only the google one.
So i need to use google authentication that firebase offers with ionic2. There is a workaround for that? (i’m getting that “location.protocol” must be http or https error on login)
Yikes, seems like
signInWithPopup()
has the same protocol check asgetRedirectResult()
. https://firebase.google.com/docs/reference/js/firebase.auth.Auth#signInWithPopupI’m a little out of my depth here on what the right way to solve this is…
Solution: the issue was corrected in the latest Firebase JavaScript SDK release (4.1.3)
Firebase JavaScript SDK Release Notes
what enviroment do you use?. In the comments sections the author says it not works in ionic view.
15 $? so hard ;s
I will try :" I can’t implement signInWithCredential with google, then i used the facebook auth for my app… This is my workaround."
2017-01-27 16:33 GMT-02:00 Diego Borges (diegobdev) < notifications@github.com>:
I sent a email from support firebase,
They answer me with the email :
I can’t implement signInWithCredential with google, then i used the facebook auth for my app… This is my workaround…
I guess that it’s not about the cordova but about a use case of app loaded from file - there is rather no reason why it should not be supported. And also this was working with firebase 2 (togheter with i.e. https://github.com/ciekawy/angular2-firebase) so this is kind of regression for people moving to new recommended firebase 3 SDK