Javascript 使用firebase的Web Google身份验证
未捕获异常:错误:中不支持此操作 运行此应用程序的环境。“位置.协议”必须 必须启用http、https或chrome扩展和web存储Javascript 使用firebase的Web Google身份验证,javascript,firebase,google-drive-api,firebase-authentication,adobe-indesign,Javascript,Firebase,Google Drive Api,Firebase Authentication,Adobe Indesign,未捕获异常:错误:中不支持此操作 运行此应用程序的环境。“位置.协议”必须 必须启用http、https或chrome扩展和web存储 试试这个代码。它应该会起作用 var config = { apiKey: "*****", authDomain: "******", }; firebase.initializeApp(config); var provider = new firebase.auth.GoogleAuthProvider();
试试这个代码。它应该会起作用
var config = {
apiKey: "*****",
authDomain: "******",
};
firebase.initializeApp(config);
var provider = new firebase.auth.GoogleAuthProvider();
provider.addScope('profile');
provider.addScope('https://www.googleapis.com/auth/drive');
firebase.auth().signInWithRedirect(provider);
//add the code below to your previous lines
firebase.auth().getRedirectResult().then(function(authData) {
console.log(authData);
}).catch(function(error) {
console.log(error);
});
未捕获异常:错误:中不支持此操作
运行此应用程序的环境。“位置.协议”必须
必须启用HTTP、HTTPS或chrome扩展和web存储
最近,我也遇到了同样的错误
您正在浏览器中直接打开此文件,而不使用任何web服务器。如果直接打开文件,Firebase身份验证将不起作用。尝试通过web服务器加载HTML,它将解决您的问题。
此错误背后的原因是,当您使用身份验证服务时,他们将使用web存储。如果不使用任何web浏览器直接打开HTML文件,则web存储不起作用
例如,在浏览器中使用apache并通过类似apache的方式打开。。。。
只需将您的文件上传到github并使用github页面运行即可(即name.github.io/yr dir/yr html文件。看起来http有问题,驱动器sdk要求您的authdomainhttps://What这是您的实际问题?该代码仅在本地主机上运行。是否可以在不使用任何web浏览器的情况下运行该代码其他文档建议运行
firebase Service
——但我不确定默认端口是什么。谢谢你的回复。是的,这是真的。我在adobe cep extension中使用该代码,它没有任何web浏览器。因此,是否可以在没有web服务器或web浏览器的情况下运行该代码对不起,不知道。@ArunKarthickis有可能使用NodeJS。有可能的话。只需创建expressjs服务器并将文件添加到其中。我在node中是新的。请给出任何示例感谢您的回复。很抱歉代码没有解决我的问题。这不是一个解决方案。这个问题仍然存在于iOS for Firebase auth by Google中
var config = {
apiKey: "*****",
authDomain: "******",
};
firebase.initializeApp(config);
var provider = new firebase.auth.GoogleAuthProvider();
provider.addScope('profile');
provider.addScope('https://www.googleapis.com/auth/drive');
firebase.auth().signInWithRedirect(provider);
//add the code below to your previous lines
firebase.auth().getRedirectResult().then(function(authData) {
console.log(authData);
}).catch(function(error) {
console.log(error);
});