code: function() {
    return new Promise(function(resolve, reject) {
      firebase.auth().onAuthStateChanged(function(user) {
        if (user) {
          user.getIdToken().then(function(idToken) {
            resolve(idToken);
          }, function(error) {
            resolve(null);
          });
        } else {
          resolve(null);
        }
      });
    }).catch(function(error) {
      console.log(error);
    });
  }
docs: Returns a promise that resolves with an ID token if available.
  @return {!Promise<?string>} The promise that resolves with an ID token if
  available. Otherwise, the promise resolves with null.