在运行该应用程序的环境中不支持此操作. "location.protocol"必须为http或https [英] This operation is not supported in the environment this application is running on. "location.protocol" must be http or https
问题描述
使用Firebase和React Native将用户身份验证到我的应用中.
Using Firebase and React Native to authenticate users into my app.
我注意到的一件事是尝试使用Facebook登录名时,但是抛出了此错误:
One thing I have noticed is when trying to use facebook login however I am thrown this error:
在运行该应用程序的环境中不支持此操作. "location.protocol"必须为http或https.
This operation is not supported in the environment this application is running on. "location.protocol" must be http or https.
不太确定如何诚实解决问题
Not really sure how to solve it honestly
推荐答案
您必须使用signInWithPopup/Redirect.当前仅在浏览器环境中支持此功能.您将需要使用一些本地库(facebook/google)来检索相应的OAuth访问令牌.收到后,您可以调用signInWithCredential来登录Firebase用户:
You must be using signInWithPopup/Redirect. This is only currently supported in a browser environment. You will need to use some native library (facebook/google) to retrieve the corresponding OAuth access token. Once you get that, you can call signInWithCredential to sign in the Firebase user:
firebase.auth().signInWithCredential(firebase.auth.FacebookAuthProvider.credential(fbAccessToken))
这篇关于在运行该应用程序的环境中不支持此操作. "location.protocol"必须为http或https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!