Hi there,

I can't say how grateful I am about the upgrade! It's brilliant. I do have
a questions though.

When I used the old library - and used simple login - I had log in code
which logged my user in fine but I also had some code like this:

var auth = new FirebaseSimpleLogin(firebaseRef, function(error, user) {
     if (!error) {
         if (user) {
             // Do my stuff to populate scope and grade odd other variables
         }
     }
});

That meant that the session was remembered and the user didn't need to
login again... now, when I refresh my page, I have to get the user to login
despite there being authData and being able to see that there's a logged in
user (checked using $scope.authObj.$getAuth();).

This is what I've tried:

var authData = $scope.authObj.$getAuth();
if (authData) {
     $scope.authObj.$authWithCustomToken(authData.token).then(function(
authData) {
         // Do my stuff to populate scope and grade odd other variables
     }).catch(function(error) {
         console.error("Authentication failed:", error);
     });
}

Any ideas what I'm doing wrong would be greatly appreciated.

Cheers,

Dom

--
You received this message because you are subscribed to the Google Groups "Firebase + AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-angular+unsubscribe@googlegroups.com.
To post to this group, send email to firebase-angular@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-angular/192aec7b-2c3f-40bc-8742-07c81f68393f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Kato Richardson at Nov 20, 2014 at 3:02 pm
    Dom,

    I'm not sure I fully understand what you're saying here and this sparse bit
    of code isn't providing a complete picture. Please realize that $getAuth()
    is a synchronous request, so if you're doing that on page load, it's not
    going to have the auth data yet (since that requires a round trip to the
    server). Instead, you'll want to use $onAuth().

    Cheers,
    Kato

    On Thu, Nov 20, 2014 at 2:08 AM, Dominic Myers wrote:

    Hi there,

    I can't say how grateful I am about the upgrade! It's brilliant. I do have
    a questions though.

    When I used the old library - and used simple login - I had log in code
    which logged my user in fine but I also had some code like this:

    var auth = new FirebaseSimpleLogin(firebaseRef, function(error, user) {
    if (!error) {
    if (user) {
    // Do my stuff to populate scope and grade odd other variables
    }
    }
    });

    That meant that the session was remembered and the user didn't need to
    login again... now, when I refresh my page, I have to get the user to login
    despite there being authData and being able to see that there's a logged in
    user (checked using $scope.authObj.$getAuth();).

    This is what I've tried:

    var authData = $scope.authObj.$getAuth();
    if (authData) {
    $scope.authObj.$authWithCustomToken(authData.token).then(function(
    authData) {
    // Do my stuff to populate scope and grade odd other variables
    }).catch(function(error) {
    console.error("Authentication failed:", error);
    });
    }

    Any ideas what I'm doing wrong would be greatly appreciated.

    Cheers,

    Dom

    --
    You received this message because you are subscribed to the Google Groups
    "Firebase + AngularJS" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to firebase-angular+unsubscribe@googlegroups.com.
    To post to this group, send email to firebase-angular@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/firebase-angular/192aec7b-2c3f-40bc-8742-07c81f68393f%40googlegroups.com
    <https://groups.google.com/d/msgid/firebase-angular/192aec7b-2c3f-40bc-8742-07c81f68393f%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Firebase + AngularJS" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to firebase-angular+unsubscribe@googlegroups.com.
    To post to this group, send email to firebase-angular@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-angular/CADypTEZd0tsvUHhBdpFAgLWtjJ%3D7xYOO7DjwtU521S%3DNvjs43Q%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupfirebase-angular @
postedNov 20, '14 at 9:08a
activeNov 20, '14 at 3:02p
posts2
users2

2 users in discussion

Kato Richardson: 1 post Dominic Myers: 1 post

People

Translate

site design / logo © 2021 Grokbase