首页 > 解决方案 > 验证电子邮件提供的 API 密钥在 Android 上已过期

问题描述

我正在使用此代码发送带有自定义 dynamicLinkDomain 的验证电子邮件links.myapp.com

final acs = ActionCodeSettings(
        url: 'https://myapp.com/finishLogin',
        handleCodeInApp: true,
        iOSBundleId: 'com.myapp.mobileApp',
        androidPackageName: 'com.myapp.mobileApp',
        androidInstallApp: true,
        androidMinimumVersion: '18',
        dynamicLinkDomain: 'links.myapp.com',
      );

      await SecureStorageService.to.postEmail(email);
      await FirebaseService.to.auth.sendSignInLinkToEmail(
        email: email,
        actionCodeSettings: acs,
      );

该 dynamicLinkDomain 设置正确,因为我在 Android 和 iOS 的应用程序中都使用它。但是当我点击 Android 设备(模拟器或真实设备)上的登录链接时,我总是收到 400 API key expired 错误

截图 2021-03-25 at 19 03 23

我试过了

但我仍然得到错误。这似乎是一个动态链接问题,但我无法发现它。有人有想法吗?

我可以看到我在电子邮件中的内容非常不同,这取决于我是否从 iOS 生成电子邮件

https://links.myapp.com/?link=https://links.myapp..com/__/auth/action?apiKey%3DAIzaS...NedNY%26mode%3DsignIn%26oobCode%3DKI4NK...F4ao-7yw%26continueUrl%3Dhttps://myapp..com/finishLogin%26lang%3Den&ibi=com.myapp..mobileApp&ifl=https://links.myapp..com/__/auth/action?apiKey%3DAIza...tNedNY%26mode%3DsignIn%26oobCode%3DKI...-7yw%26continueUrl%3Dhttps://myapp..com/finishLogin%26lang%3Den

或安卓

https://links.myapp.com/__/auth/action?apiKey=AIza...edNY&mode=signIn&oobCode=XQI...2pCw&continueUrl=https://myapp.com/finishLogin&lang=en

这正常吗?

标签: androidflutterfirebase-authenticationfirebase-dynamic-links

解决方案


推荐阅读