Matt Sanford Matt Sanford - 6 months ago 21
Javascript Question

Transport Unavailable for OAuth

I am trying to login with google into my firebase project and I am getting a transport unavailable error with both the popup and redirect functions from firebase. Is it because I am working locally or am I doing something wrong here?

var app = angular.module('WOM', ["firebase"]);
app.controller('SampleCtrl', ['$scope', '$firebaseObject', '$firebaseAuth', function($scope, $firebaseObject, $firebaseAuth){
var ref = new Firebase('https://who-owes-me.firebaseio.com/'); //Where data is stored
var auth = $firebaseAuth(ref);

$scope.login = function() {
$scope.authData = null;
$scope.error = null;

auth.$authWithOAuthPopup("google").then(function(authData){
$scope.authData = authData;
}).catch(function(error){
$scope.error = error;
});
}

$scope.data = $firebaseObject(ref); //assign data to scope

$scope.data.$loaded()
.then(function(){
console.log($scope.data);
})
.catch(function(err){
console.error(err);
})
}]);

Answer

This likely means that you're working off the file system.

In order to run Auth methods, you'll have to be working on a bona-fide server. It's a good practice in general to develop off of a local server rather than the file system as that's closer to what the production environment behave like.

Try the http-server npm module to get up and running quickly.