WebArtisan
WebArtisan

Reputation: 4227

AngularFire Get users list

I'm trying to get list of users from my firebase, but my getUsers method returns undefined. Why this happens and what is correct way to get users array from "Authentificated" section?

enter image description here

What I tried to do:

provider-

export class FirebaseProvider {

  constructor(private afdatabase: AngularFireDatabase) {}

  getUsers() {
    return this.afdatabase.list('/users');
  }
}

users.ts -

export class UsersPage {

  usersList: FirebaseListObservable<any[]>

  constructor(private firebaseProvider: FirebaseProvider) {

    this.usersList = this.firebaseProvider.getUsers()

  }
}

Upvotes: 1

Views: 4694

Answers (1)

Lim Kayas
Lim Kayas

Reputation: 342

It seems like you need to create users in database section, cuz firebase won't let you to fetch users list from "authentificated" section for security reasons.

See: How do I return a list of users if I use the Firebase simple username & password authentication

Upvotes: 3

Related Questions