I'm currently facing a dilemma in determining the most secure method to obtain an authenticated user's uid
using AngularFire2. There seem to be two viable approaches available, but I am uncertain about which one offers the best security measures or if there are specific requirements that need to be met beforehand.
Method 1: Utilize the auth variable
constructor(private afAuth: AngularFireAuth) {
let uid = this.afAuth.auth.currentUser.uid
}
Method 2: Subscribe to authState
constructor(private afAuth: AngularFireAuth) {
let uid = this.afAuth.authState.subscribe(user => user.uid)
}