# Firebase logged user data fetch - Solution

**URL:** <https://forum.ionicframework.com/t/firebase-logged-user-data-fetch-solution/142176>\
**Category:** Ionic Framework\
**Created:** [September 19, 2018, 9:29am UTC](https://forum.ionicframework.com/t/firebase-logged-user-data-fetch-solution/142176 "2018-09-19T09:29:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![champion007](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@champion007](https://forum.ionicframework.com/u/champion007)\
**Post date:** [September 19, 2018, 9:29am UTC](https://forum.ionicframework.com/t/firebase-logged-user-data-fetch-solution/142176/1 "2018-09-19T09:29:28Z")

</div>

Steps -

install @angular/fire plugin and set firebase config details obtained from firebase console and use the below code to get logged in details from firebase DB -

```auto
async fetchUserData() {
    try {
      await this.fireAuth.authState.subscribe(data => {
        if (data.uid)
          this.fireDatabase.object(data.uid).valueChanges().subscribe(response => {
            this.post = response;
            console.log(this.post);
          })
      })
    } catch (e) {
      console.log(`you are not authorized - ${e}`)
    }
  }

```

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:16pm UTC](https://forum.ionicframework.com/t/firebase-logged-user-data-fetch-solution/142176/2 "2021-07-19T21:16:21Z")

</div>

Closed on July 19, 2021, 9:16pm UTC


