sahat/satellizer

Facebook login not working

claudneto opened this issue · 1 comments

Hello guys! Maybe I've done anything wrong, but I need some help.
These are my codes:

App.js

$authProvider.facebook({
  clientId: '*********',
  responseType: 'token',
  redirectUri: location.origin + location.pathname // redirect to the same page
});

Controller

$scope.isAuthenticated = function () {
    //if I "alert" AuthenticationService.IsAuthenticated method, it returns undefined several times and then my page loads
    return AuthenticationService.IsAuthenticated();
};

$scope.LogOut = function () {
    // I couldn't test, because LogIn doesn't work
    AuthenticationService.LogOut();
};

$scope.LogIn = function () {
    // opens popup, I authorize the app, but nothing happens after this is closed
    AuthenticationService.LogIn();
};

AuthenticationService

this.LogIn = function () {
    $auth.authenticate('facebook').then(function (response) {
      alert($auth.isAuthenticated()); // returns true, but my logo disappears when popup is closed and $scope.isAuthenticated keeps undefined
    });
};

this.LogOut = function () {
    // couldn't be tested yet
    $auth.logout();
};

this.IsAuthenticated = function () {
    // stays true right after login, but then it becomes undefined
    $auth.isAuthenticated();
};

What am I doing wrong? I guess it's not keeping my Facebook access token into local storage.
I created my Facebook App, got my AppId, set in app.js config method and set my website url to http://localhost:3000 in Facebook App config page.

facing same issues like you