简体   繁体   English

Firebase getIdToken 返回对象

[英]Firebase getIdToken returns object

I am using redux-saga and redux-saga-firebase library to integrate firebase with redux-sagas.我正在使用redux-sagaredux-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: getIdTokengetIdTokenResult方法只返回具有以下表示形式的对象:

{
    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.

相关问题 Firebase .getIdToken() 返回无效令牌 - Firebase .getIdToken() returns invalid token Firebase currentUser.getIdToken() 在 signInWithCustomToken 之后返回自定义令牌 - Firebase currentUser.getIdToken() returns custom token after signInWithCustomToken Firebase getIdToken 不起作用 - Firebase getIdToken not working firebase版本9中的getIdToken()认证方法如何使用? - How to use the getIdToken() auth method in firebase version 9? getIdToken()不是函数,即使它像firebase文档中的函数一样使用 - getIdToken() is not a function, even if It is used like a function in firebase document Firebase:TypeError:无法读取未定义的属性(读取“getIdToken”) - Firebase: TypeError: Cannot read properties of undefined (reading 'getIdToken') 在 ZBF12E1515C251C7D8A1C5Z0352 中实施 session cookies 后无法读取 null 的属性“getIdToken” - Cannot read property 'getIdToken' of null after implementing session cookies in firebase 如何将 firebase jwt getIdToken 发送到 http 获取 ZD18B8624A0F5F721DA7B8235Z 中的请求 - How to send firebase jwt getIdToken to http get request in angular 8? 如何在 reactjs 中发送 firebase getIdToken 和 axios? - How can i send firebase getIdToken with axios in reactjs? Firebase检索返回未定义/对象对象 - Firebase retrieve returns undefined/object Object
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM