简体   繁体   English

Angular + Firebase + Cordova 谷歌授权

[英]Angular + Firebase + Cordova google auth

I have a ready-made web application on Angular 10 + Firebase with Google Account authorization.我在 Angular 10 + Firebase 上有一个现成的 web 应用程序,具有 Google 帐户授权。

But when I made android app with cordova但是当我用 cordova 制作 android 应用程序时

angularFireAuth.signInWithPopup(provider)

It didn't work, failing with:它没有用,失败了:

Error: This operation is not supported in the environment this application is running on.错误:运行此应用程序的环境不支持此操作。 "location.protocol" must be http, https or chrome-extension and web storage must be enabled. “location.protocol”必须是 http、https 或 chrome-extension 并且必须启用 web 存储。

The same to angularFireAuth.signInWithRedirect(provider) .angularFireAuth.signInWithRedirect(provider)相同。

What should I use to make google auth in angular + cordova + firebase android app?我应该使用什么在 angular + cordova + firebase android 应用程序中进行谷歌身份验证?

I've read https://firebase.google.com/docs/auth/web/cordova but it didn't help -- I can't install all plugins (errors appear), and all I've read about cordova didn't help because I have main functionality in my Angular AuthService, where I'm using AngularFireAuth.我读过https://firebase.google.com/docs/auth/web/cordova但它没有帮助——我无法安装所有插件(出现错误),我读过的关于 cordova 的所有内容都没有没用,因为我的 Angular AuthService 中有主要功能,我在其中使用 AngularFireAuth。

This is my first project with cordova and angularfire, so I'm stuck and I can't find the answer anywhere.这是我使用 cordova 和 angularfire 的第一个项目,所以我被卡住了,到处都找不到答案。

Either use cordova-plugin-ionic-webview to load the Cordova app into the Webview using http:// instead of file:// .使用cordova-plugin-ionic-webview使用http://而不是file://将 Cordova 应用加载到 Webview 中。

Or use native mobile Firebase SDK eg cordova-plugin-firebasex and use authenticateUserWithGoogle() .或者使用本机移动 Firebase SDK 例如cordova-plugin- firebasex 并使用authenticateUserWithGoogle()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM