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 -
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}`)
}
}