You're viewing the legacy docs. They are deprecated as of May 18, 2016.
These docs are for version 2.4.2 and below of the Javascript SDK. Go to our current docs, or see our Web migration guide.

Version 2.4.2Changelog


Returns the current authentication state of the Firebase client. If the client is unauthenticated, this method will return null. Otherwise, the return value will be an object containing at least the following fields, and possibly more depending upon the provider used to authenticate.

authData object
Field Description Type
uid The user's unique id across all providers. String
provider Unique string identifying the authentication provider, i.e. google. String
token The Firebase auth token used to authenticate the client. String
expires The session expiration time in seconds since the Unix epoch. Number
auth The contents of the auth. token, available as auth in your Security and Firebase Rules. Object
var ref = new Firebase("https://<YOUR-FIREBASE-APP>");
var authData = ref.getAuth();

if (authData) {
  console.log("Authenticated user with uid:", authData.uid);