简体   繁体   English

在 Android Cordova 上使用 Firebase Auth 进行 Google 登录不起作用

[英]Google Signin with Firebase Auth on Android Cordova not working

I spent hours trying to make Google Signin work on Android with Cordova (it was working on iOS / Web).我花了几个小时试图让谷歌登录在 Android 和 Cordova 上工作(它在 iOS / Web 上工作)。 I have followed these instructions: https://firebase.google.com/docs/auth/web/cordova我已按照以下说明操作: https://firebase.google.com/docs/auth/web/cordova

I was trying to use a custom Dynamic Link ("mydomain.com/link") and it was not working: after authenticating, the user was redirected to the website INSIDE the popup, instead of closing it and authenticate in the app.我试图使用自定义动态链接(“mydomain.com/link”)但它不起作用:身份验证后,用户被重定向到弹出窗口内的网站,而不是关闭它并在应用程序中进行身份验证。

So I decided to create a simple "myapp.page.link", but it was not working neither.所以我决定创建一个简单的“myapp.page.link”,但它也不起作用。

Finally, I simply deleted my custom Dynamic Link, and voila, it works!最后,我只是删除了我的自定义动态链接,瞧,它可以工作了!

So you can use a custom domain for the AUTH_DOMAIN , but not for the DYNAMIC_LINK_DOMAIN .因此,您可以为AUTH_DOMAIN使用自定义域,但不能为DYNAMIC_LINK_DOMAIN使用自定义域。 Important: if you use a custom AUTH_DOMAIN , you will have to change manually the authDomain attribute in the firebase config of your app.重要提示:如果您使用自定义AUTH_DOMAIN ,则必须手动更改应用程序 firebase 配置中的authDomain属性。

@Firebase team: I think it could be useful to update the doc to precise that: @Firebase 团队:我认为更新文档以精确说明:

  • you cannot use custom Dynamic Link您不能使用自定义动态链接
  • you cannot have several Dynamic Link active您不能同时激活多个动态链接

And ideally, it would be ideal to explain how the Dynamic Link is used by Firebase Auth: I followed the explanation, thought that any dynamic link would do the trick, but since you do not explain how it works, it's extremely hard to guess that it is not the case, and that having several dynamic links can be an issue.理想情况下,最好解释一下 Firebase 如何使用动态链接事实并非如此,拥有多个动态链接可能是个问题。

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

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