0

I used ref.authWithCustomToken(), but the payload that is returned has null properties: auth, expires, token, uid. Except for the 'provider' property which is set to 'custom'. The authData object has null values. What is more curious is its not saying "Login Failed!", its saying Authenticated successfully with payload: null.

What is the reason for this?

var ref = new Firebase(kRootRefURL);
ref.authWithCustomToken(kSecret, function(error, authData) {
  if (error) {
    console.log("Login Failed!", error);
  } else {
    console.log("Authenticated successfully with payload:", authData);
  }
});

I took an additional step set an onAuth() listener to just log the authData to the console but it, too, is null.

nodebase
  • 2,510
  • 6
  • 31
  • 46
  • I wonder if its a special case in that its because I am authenticating with SECRET. – nodebase Apr 12 '15 at 20:51
  • If you are worried about not having any authData, you may also consider setting up the server authentication using custom auth as Jenny describes here: http://stackoverflow.com/questions/29240940/how-do-you-authenticate-a-server-to-firebase/29240941#29240941 – Frank van Puffelen Apr 13 '15 at 19:02

1 Answers1

4

The authData refers to the auth. credential payload (usually a JSON Web Token), which would normally show up in your security rules under the auth variable, for use in restricting read / write access to your Firebase.

When authenticating with a secret, there is no payload and thus the null-value authData, despite being authenticated.

Rob DiMarco
  • 13,226
  • 1
  • 43
  • 55