location.protocol"必须为http或https [英] location.protocol" must be http or https

查看:299
本文介绍了location.protocol"必须为http或https的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Cordova + Angular 2 + Ionic 2开发了混合移动应用程序.

I developing a hybrid mobile application using Cordova + Angular 2 + Ionic 2.

在使用Firebase Auth时,当调用signInWithPopup()或signInWithRedirect()进行社交登录时,firebase返回错误此应用程序正在运行的环境中不支持此操作."location.protocol"必须为http或https. "

When using firebase Auth, when calling signInWithPopup() or signInWithRedirect() for social logins, firebase returns error "This operation is not supported in the environment this application is running on. "location.protocol" must be http or https."

这篇文章也有很多评论,关于同一件事:

There's also a number of comments on this article, about same thing: https://firebase.googleblog.com/2016/01/social-login-with-ionic_77.html

这是因为location.protocol是file://,而不是http/s.所有混合应用程序都会出现此问题.

This is because the location.protocol is file:// and NOT http/s. All hybrid apps will have this issue.

帮助.

推荐答案

该方法无效

说明: 您正在尝试使用firebase Web SDK将混合应用程序连接到firebase,因此firebase不允许连接.

Explanation: You are trying to connect your hybrid application to firebase using firebase web SDK, so firebase is not allowing to connect.

仅允许基于HTTP和https的应用程序使用Web SDK

web SDK is allowed for only HTTP and https based applications

要进行连接,请使用移动应用程序SDK(Android和IOS有单独的SDK)

如果您正在使用expo构建应用程序,则建议的方法是使用signInWith用户名和密码.

If you are using expo to build your application, the recommended way is to use the signInWith UserName and password.

高级解决方案:,您需要相应地更改babel配置

Advanced solution: you need to change the babel config correspondingly

这篇关于location.protocol"必须为http或https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆