Skip to content

Instantly share code, notes, and snippets.

@jbinto
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbinto/9676545 to your computer and use it in GitHub Desktop.
Save jbinto/9676545 to your computer and use it in GitHub Desktop.
thinkster.io chapter 6 fixes - user not signed in after registering

Firebase 'Auth' section now 'Simple Login'

In the Firebase Forge, navigate to the 'Auth' section. Under the 'Authentication Providers' header, select the 'Email & Password' option, and check 'Enable'.

It's now just called "Simple Login". See https://pbs.twimg.com/media/BjMkJAjCMAAvCGT.png

User is not signed in after registering

Now when we register, we should be redirected to the posts page and a log out button should appear in the navbar.

This doesn't happen. I spent a long time not understanding what was going on, thinking I had something wrong with my ng-show="signedIn()". I traced it all the way up to auth.user == null, thinking something was broken. Eventually I figured out that I'm not actually being signed in.

See Firebase Simple Login docs for createUser:

Creates a new account for the specified email address. Note that this function does not log the user in automatically; you must call login( ) after account creation completes.

I made this work as described by the tutorial by calling $scope.login() inside the success callback for register:

$scope.register = function() {
  Auth.register($scope.user).then(
    function(authUser) {
      console.log(authUser);
      $scope.login();
      $location.path('/');
    },
    function(error) {
      $scope.error = error.toString();
    }
  );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment