Hello !
[ Tested on a Nexus 5 running Android 5.0]
I followed Firebase’s guide to initialize login with AngularFire there : https://www.firebase.com/docs/web/libraries/angular/guide.html#section-angular-authentication, the second code area. After clicking on the button that takes me to the Facebook login page, I just push “back”, but it doesn’t takes me back to my login page : it fails with the following error :
Uncaught ReferenceError: cordova is not defined
If I simply remove ‘ionic’ from dependencies, it works perfectly.
If you want to reproduce, here is my HTML :
<!DOCTYPE html>
<html ng-app="sampleApp">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="https://cdn.firebase.com/js/client/2.0.4/firebase.js"></script>
<script src="https://cdn.firebase.com/libs/angularfire/0.9.0/angularfire.min.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>
</head>
<body ng-controller="SampleCtrl">
<div ng-show="user">
<p>Hello, {{ user.facebook.displayName }}</p>
<button ng-click="auth.$unauth()">Logout</button>
</div>
<div ng-hide="user">
<p>Welcome, please log in.</p>
<button ng-click="auth.$authWithOAuthPopup('facebook')">Login</button>
</div>
</body>
</html>
And the JS :
var app = angular.module('sampleApp', ['ionic', 'firebase'])
// let's create a re-usable factory that generates the $firebaseAuth instance
app.factory("Auth", ["$firebaseAuth", function($firebaseAuth) {
var ref = new Firebase("https://pixift.firebaseio.com/");
return $firebaseAuth(ref);
}]);
// and use it in our controller
app.controller("SampleCtrl", ["$scope", "Auth", function($scope, Auth) {
$scope.auth = Auth;
$scope.user = $scope.auth.$getAuth();
}]);
Hopefully someone will be able to help me, because I’m like, wtf ?
Thanks
[EDIT] Same error testing on an emulator of a Nexus 5 running 4.4.4 on Genymotion.