Firebase Login getting User's info

Hey guys, I’ve been having a hard time with Firebase and I wonder if anybody could help me out.

I’m at the ‘main page’ of my application, the user has already been logged in using the email and password authentication. After the user gets authenticated, he goes to a profile page, on which will grab the UID and ask for the First Name, Last Name and Nickname. No problem with that part.

Now, I need to be able to pull that information from the user and display on the screen, something like “Hey FirstName, how are you”.

I’ve been testing out and I’m getting on the console a [object Object]. Can anybody shine a light into this for me?

Here is my code:

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { AngularFireAuth } from 'angularfire2/auth';
import { User } from '../../models/user';
import { AngularFireObject } from 'angularfire2/database/interfaces';
import { Profile } from '../../models/profile';
import { AngularFireDatabase } from 'angularfire2/database';

  selector: 'page-home',
  templateUrl: 'home.html',
export class HomePage {
  profileData: AngularFireObject<Profile>;

  user = {} as User;
  profile = {} as Profile;

  constructor(public navCtrl: NavController, public navParams: NavParams, private afAuth: AngularFireAuth, private afData: AngularFireDatabase) {

  getCurrentUser() {
    this.afAuth.authState.subscribe(data => {
      console.log('A informacao de data ' + data.uid);
      return data.uid;

  getUserFirstName() {
    this.profileData = this.afData.object(`profile/` + this.getCurrentUser());
    return this.profileData;

  ionViewDidLoad() {
    console.log('The Users first name is ' + this.getUserFirstName());


I really really appreciate if anybody can help me out.


Dont use the + in the console log command as it will convert the object to a string [object object]. Use comma so you can inspect the result

1 Like