[英]Firebase getIdToken returns object
I am using redux-saga and redux-saga-firebase library to integrate firebase with redux-sagas.我正在使用redux-saga和redux-saga-firebase库将firebase与 redux- saga集成。 The problem is when I sign in a user, for example with
signInWithEmailAndPassword
and even connect channel
to get the signed user and track user changes, I am not able to get correct token.问题是当我登录用户时,例如使用
signInWithEmailAndPassword
甚至连接channel
以获取已签名用户并跟踪用户更改时,我无法获得正确的令牌。 getIdToken
, getIdTokenResult
methods just return objects with the following representation: 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
}
And here is the code:这是代码:
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');
}
}
}
What am I doing wrong?我究竟做错了什么?
getIdToken 返回一个承诺,确保你使用getIdToken().then((token) => console.log(token))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.