Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Firebase Auth not returning request.auth after login #2869

Unanswered
VuPhamCongMinh asked this question in Q&A
Discussion options

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

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

Read #2857

Fixed by downgrading to firebase 8.3.0

You must be logged in to vote
1 reply
Comment options

Thanks you, it works now !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /