gpt4 book ai didi

firebase-authentication - 当前环境不支持指定的持久化类型

转载 作者:行者123 更新时间:2023-12-04 04:17:28 26 4
gpt4 key购买 nike

https://firebase.google.com/docs/auth/web/auth-state-persistence

The default for web browser and React Native apps is local (provided the browser supports this storage mechanism, eg. 3rd party cookies/data are enabled) whereas it is none for Node.js backend apps.

当我在我的 React Native Android 应用程序中尝试以下操作时:

const signIn = () =>
firebase.auth().setPersistence(firebase.auth.Auth.Persistence.LOCAL).then(() => {
return firebase.auth().signInAnonymously();
});

我收到以下错误:

The current environment does not support the specified persistence type.

这是一个错误还是我遗漏了文档中的某些内容?

环境:

"dependencies": {
"firebase": "^4.5.0",
"react": "16.0.0-alpha.12",
"react-native": "^0.48.4",
}

Android 7.0

最佳答案

似乎在选择性导入 firebase 模块时存在错误。
更改导入自

import * as firebase from 'firebase/app';
import 'firebase/auth';

import firebase from 'firebase';  

解决了这个问题。

关于firebase-authentication - 当前环境不支持指定的持久化类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46637992/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com