我正在使用 EmberFire 和 Torii 进行会话。当我注销用户时,我遇到了一个奇怪的问题,并且控制台中抛出了以下错误:
firebase.js:186 Error: permission_denied at /folders/-KKvrk3K_JOHxQWgR1km: Client doesn't have permission to access the desired data.(…)(anonymous function) @ firebase.js:186(anonymous function) @ firebase.js:380Tb @ firebase.js:276uc @ firebase.js:263vc @ firebase.js:262(anonymous function) @ firebase.js:449vh @ firebase.js:434g.wd @ firebase.js:425Ye.wd @ firebase.js:328(anonymous function) @ firebase.js:326vd @ firebase.js:279La.onmessage @ firebase.js:278
firebase.js:186 Error: permission_denied at /folders/-KLFp3zh5QUB7KvMF0HZ: Client doesn't have permission to access the desired data.(…)(anonymous function) @ firebase.js:186(anonymous function) @ firebase.js:380Tb @ firebase.js:276uc @ firebase.js:263vc @ firebase.js:262(anonymous function) @ firebase.js:449vh @ firebase.js:434g.wd @ firebase.js:425Ye.wd @ firebase.js:328(anonymous function) @ firebase.js:326vd @ firebase.js:279La.onmessage @ firebase.js:278
firebase.js:186 Error: permission_denied at /externalApps/-KLF_wKXtzm38EHtuQ_C: Client doesn't have permission to access the desired data.(…)(anonymous function) @ firebase.js:186(anonymous function) @ firebase.js:380Tb @ firebase.js:276uc @ firebase.js:263vc @ firebase.js:262(anonymous function) @ firebase.js:449vh @ firebase.js:434g.wd @ firebase.js:425Ye.wd @ firebase.js:328(anonymous function) @ firebase.js:326vd @ firebase.js:279La.onmessage @ firebase.js:278
firebase.js:186 Error: permission_denied at /users/-KLKUOZRBCIeCj44WMe7: Client doesn't have permission to access the desired data.(…)(anonymous function) @ firebase.js:186(anonymous function) @ firebase.js:380Tb @ firebase.js:276uc @ firebase.js:263vc @ firebase.js:262(anonymous function) @ firebase.js:449vh @ firebase.js:434g.wd @ firebase.js:425Ye.wd @ firebase.js:328(anonymous function) @ firebase.js:326vd @ firebase.js:279La.onmessage @ firebase.js:278
firebase.js:186 Error: permission_denied at /externalApps/-KLIyXUwTSrkCIL4rz7U: Client doesn't have permission to access the desired data.
我在两个地方登录用户:
注册时
register(data) {
return this.get('firebaseApp')
.auth()
.createUserWithEmailAndPassword(data.email, data.password)
.then((registeredUser) => {
const newUser = this.store.createRecord('user', {
uid: registeredUser.uid,
firstName: data.firstName,
lastName: data.lastName,
email: registeredUser.email
})
return newUser.save();
})
.then((savedUser) => {
return this.get('session').fetch().then(() => {
return savedUser;
});
})
.then((savedUser) => {
this.replaceWith('dashboard');
});
}
对于已经注册的用户
login(email, password) {
const controller = this.controllerFor('index');
this.get('session').open('firebase', {
provider: 'password',
email: email,
password: password
})
.then((/* response */) => {
controller.set('loginError', undefined);
this.replaceWith('dashboard');
})
.catch((error) => {
controller.set('loginError', error);
});
}
这是注销用户的操作:
logout() {
this.get('session').close().then(() => {
this.store.unloadAll();
this.replaceWith('index');
});
}