-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Firebase Auth not returning request.auth after login #2869
Unanswered
VuPhamCongMinh
asked this question in
Q&A
-
Here's a snippet of my code where i'm trying to add User to Firestore after they succefully logged in :
async loginWithEmail(email: string, password: string): Promise<void> { return await this.angularFireAuth .signInWithEmailAndPassword(email, password) .then(async (credential) => { await this.updateUserData(credential); }); } async updateUserData({ user }: firebase.auth.UserCredential): Promise<void> { const userRef: AngularFirestoreDocument<any> = this.angularFirestore.doc( `users/${user.uid}` ); const data: User = { uid: user.uid, email: user.email, roles: { admin: true, }, }; return userRef.set(data, { merge: true }); }
and here is my Firestore rule :
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}
Everytime im trying to login i'm always get the FirebaseError: [code=permission-denied]: The caller does not have permission
which i think that cause by request not passing the firestore's rule
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 1 reply
-
Read #2857
Fixed by downgrading to firebase 8.3.0
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1
1 reply
-
Thanks you, it works now !
Beta Was this translation helpful? Give feedback.
All reactions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment