【发布时间】:2019-05-21 18:09:39
【问题描述】:
我正在使用redux-saga 和redux-saga-firebase 库将firebase 与redux-sagas 集成。问题是当我登录用户时,例如使用signInWithEmailAndPassword 甚至连接channel 以获取签名用户并跟踪用户更改,我无法获得正确的令牌。 getIdToken、getIdTokenResult 方法只返回具有以下表示的对象:
{
a: 0
b: qb {a: null, g: ƒ, b: ƒ, f: undefined, next: null, …}
c: A {a: 0, i: undefined, c: A, b: qb, f: qb, …}
f: qb {a: null, g: ƒ, b: ƒ, f: undefined, next: null, …}
g: false
h: false
i: undefined
}
这里是代码:
function* loginSaga({ payload: { email, password } }) {
try {
yield call(
reduxSagaFirebase.auth.signInWithEmailAndPassword,
email,
password,
);
} catch (error) {
yield put(loginFailure(error));
}
}
function* loginStatusWatcher() {
const channel = yield call(reduxSagaFirebase.auth.channel);
while (true) {
const { user } = yield take(channel);
if (user) {
yield put(loginSuccess());
} else {
console.log('Put logout action here');
}
}
}
我做错了什么?
【问题讨论】:
-
这个问题你解决了吗?我有同样的问题。
标签: javascript firebase firebase-authentication redux-saga