小编And*_*ani的帖子

Firebase + Ionic + Cordova s​​ignInWithRedirect在Android上重定向到localhost

经过一系列更新,我最近重新构建了Ionic应用程序,并signInWithRedirect停止在Android上运行,并在登录后重定向到localhost:8080,而在iOS上还可以。

这是我的package.json

{
  ...
  "dependencies": {
    ...,
    "firebase": "5.4.2",
    "@angular/fire": "5.0.0",
    "@ionic-native/firebase": "4.12.2",
    "cordova-plugin-browsertab": "^0.2.0",
    "cordova-plugin-buildinfo": "2.0.2",
    "cordova-plugin-customurlscheme": "4.3.0",
    "cordova-plugin-firebase": "2.0.0",
    "cordova-plugin-ionic-webview": "2.1.4",
    "cordova-universal-links-plugin": "git+https://github.com/andyepx/cordova-universal-links-plugin.git#b91b58fb8a7ff9f2b2de83b4adceece13e9cf2a8",
  },
  ...
  "cordova": {
    "plugins": {
      ...
      "cordova-plugin-local-notification": {},
      "cordova-plugin-firebase": {},
      "cordova-plugin-browsertab": {},
      "cordova-universal-links-plugin": {}
    },
}
Run Code Online (Sandbox Code Playgroud)

cordova-universal-links-plugin我使用的版本是原始插件的分支,并针对Cordova 8进行了一些修复。

config.xml

<preference name="AndroidLaunchMode" value="singleTask" />

<universal-links>
        <host event="openAppEvent" name="app.my.com" scheme="https" />
        <host name="myapp.page.link" scheme="https" />
        <host name="myapp.app.goo.gl" scheme="https" />
        <host name="myapp.firebaseapp.com" scheme="https">
            <path url="/__/auth/callback" />
        </host> …
Run Code Online (Sandbox Code Playgroud)

android cordova firebase ionic-framework firebase-authentication

5
推荐指数
2
解决办法
912
查看次数