[英]Flutter Firebase Email Passwordless login - Link giving error
I have a flutter app in which I'm trying to use firebase Email passwordless sign in. The sending part is working, but when I open the link I get an error:我有一个 flutter 应用程序,我在其中尝试使用 firebase Email 无密码登录。发送部分正在工作,但是当我打开链接时出现错误:
The handleCodeInApp parameter in the actioncode settings is true however.但是,actioncode 设置中的 handleCodeInApp 参数为 true。
_firebaseAuth.sendSignInLinkToEmail(
email: email.value,
actionCodeSettings: firebase_auth.ActionCodeSettings(
url: uri.toString(),
iOSBundleId: "myPackageName",
androidPackageName: "myPackageName",
androidMinimumVersion: '0',
androidInstallApp: false,
handleCodeInApp: true,
dynamicLinkDomain: "myPackageName",
),
);
The Uri gets created here: Uri 在此处创建:
DynamicLinkParameters parameters = DynamicLinkParameters(
uriPrefix: 'https://myRegisteredDomain',
link: Uri.parse('https://myRegisteredDomain'),
androidParameters: AndroidParameters(
packageName: 'myPackageName',
minimumVersion: 0,
),
iosParameters: IosParameters(
bundleId: 'myPackageName',
minimumVersion: '0',
),
);
return await parameters.buildUrl();
Intent filter is set up as follows: Intent 过滤器设置如下:
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="myRegisteredDomain" android:scheme="https"/>
<data android:host="myRegisteredDomain" android:scheme="http"/>
</intent-filter>
In firebase I have set up the domain as needed and it has been whitelisted.在 firebase 中,我根据需要设置了域,并且已将其列入白名单。 At this point I have no idea why I'm even getting this error as handleCodeInApp is set to true.
在这一点上,我不知道为什么我什至会收到这个错误,因为 handleCodeInApp 设置为 true。 I can only guess that my link is incorrect in some way, but I wouldn't know where I set it up wrong.
我只能猜测我的链接在某些方面不正确,但我不知道我在哪里设置错误。 If anyone knows where I went wrong or you need additional information, please tell me.
如果有人知道我哪里出错了或者您需要更多信息,请告诉我。
Solution解决方案
The Uri generated using the DynamicLinkParameters does not work.使用 DynamicLinkParameters 生成的 Uri 不起作用。 Just use a string like: "https://PROJECT.page.link".
只需使用如下字符串:“https://PROJECT.page.link”。 This solved the error I was getting.
这解决了我遇到的错误。
The isSignInWithEmailLink check from FirebaseAuth isn't working correctly with version ^0.20.0+1, which I was using. FirebaseAuth 的 isSignInWithEmailLink 检查不适用于我使用的版本 ^0.20.0+1。 Reference https://github.com/FirebaseExtended/flutterfire/issues/4711#issuecomment-762323661 on how to fix this.
有关如何解决此问题的参考https://github.com/FirebaseExtended/flutterfire/issues/4711#issuecomment-762323661 。 After this fix I can now use Passwordless sign in as intended
修复此问题后,我现在可以按预期使用无密码登录
You should follow Firebase Email Link Authentication example guide at FlutterFire您应该遵循 FlutterFire 上的 Firebase Email 链接身份验证示例指南
https://firebase.flutter.dev/docs/auth/usage/#email-link-authentication https://firebase.flutter.dev/docs/auth/usage/#email-link-authentication
It works like a charm.它就像一个魅力。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.