【发布时间】:2017-06-08 20:41:43
【问题描述】:
我看到了这个错误:
错误:环境不支持此操作 应用程序正在运行。 “location.protocol”必须是 http、https 或 必须启用 chrome 扩展和网络存储。
当我使用时:
firebase.auth().signInWithPopup(provider)
.then(function(result) {
console.log(result);
})
.catch(function(error) {
console.log('popup', error);
//webSettings.setDomStorageEnabled(true);
firebase.auth().signInWithRedirect(provider)
.then(function(result) {
console.log(result);
})
.catch(function(error) {
console.log('redirect', error);
firebase.auth().signInAnonymously().catch(function(error) {
console.log('anonymous', error);
});
});
});
通过弹出和重定向的前两次登录尝试失败。它似乎只发生在 iOS Safari 上。
我看到其他人报告了 Cordova 的问题,但我没有看到答案,我只使用 web 和 firebase。不是 Cordova 或 ionic 等。
匿名登录在 iOS 上有效,但这只是一个测试,并不是我们想要使用的。
如果你想测试它,你可以在 iOS 上使用来自 Safari 的https://meetup-reporter.firebaseapp.com/
返回的 Promise 中错误对象的示例转储是:
{"code": "auth/operation-not-supported-in-this-environment", “构造函数”:函数(a,b) {this.code="auth/"+a;this.message=b||Xf[a]||"";}, "F": 函数 () {return{code:this.code,message:this.message}},“line”:44,“message”: “此应用程序的环境不支持此操作 正在运行。 \"location.protocol\" 必须是 http、https 或 必须启用 chrome 扩展和网络存储。", "sourceURL": "https://meetup-reporter.firebaseapp.com//firebase/4.1.2/firebase-auth.js", “堆”: "https://meetup-reporter.firebaseapp.com//firebase/4.1.2/firebase-auth.js:44:638\nhttps://meetup-reporter.firebaseapp.com//firebase/4.1.2/firebase-auth.js:45:258\nA@https://meetup-reporter.firebaseapp.com//firebase/4.1 .2/firebase-auth.js:44:545\nD@https://meetup-reporter.firebaseapp.com//firebase/4.1.2/firebase-auth.js:45:242\nsignInWithPopup@https://meetup-reporter.firebaseapp.com//firebase/4.1.2/firebase-auth.js:241:48\na@https://meetup-reporter.firebaseapp.com/__/firebase/4.1.2/firebase-auth.js:260:432\nhttps://meetup-reporter.firebaseapp.com/scripts/main.js:430 :36", "toJSON": 函数 () {var a=Array.prototype.slice.call(参数);a:{var e=Array.prototype.slice.call(a);var l=0;for(var n=!1,C=0;Cl||l>=fk.length)throw new N("internal-error","Argument 验证器收到的参数数量不受支持。");e=fk[l]+" 参数 "+(e.name?'"'+e.name+'" ':"")+" 必须是 "+e.N+".";break a}e=null}}if(e)throw new N("argument-error",d+" failed: "+e);return b.apply(this,a);}}
【问题讨论】:
标签: ios firebase firebase-authentication mobile-safari