Closed wolframm closed 3 years ago
I came across this issue today. After hours of research and debugging, I've decided to use earlier versions of Firebase packages because 3 days ago, I upgraded all of my Firebase packages and thought that maybe this was the source of this problem.
So, in my pubspec.yaml file, I had the following Firebase packages installed. With these versions, the Passwordless Sign In wasn't working. firebase_auth: ^0.20.0+1 firebase_core: ^0.7.0 firebase_dynamic_links: ^0.7.0+1
After downgrading, now I have the following versions installed and the Passwordless Sign In is working. firebase_auth: ^0.18.4+1 firebase_core: ^0.5.3 firebase_dynamic_links: ^0.6.3
@rrousselGit Do you have any suggestions?
Observations:
Observations:
- With firebase_auth: ^0.18.4+1, link received in email is a valid "page.link" which opens app correctly.
- With firebase_auth: ^0.20.0+1, link received in email is not a dynamic link, it opens in webpage and redirects to given URL within browser. 0.18.4+1 is the best we have for email link login now.
Is this intended behaviour? I am having similar problems. Our login with email link stopped working aswell.
Observations:
- With firebase_auth: ^0.18.4+1, link received in email is a valid "page.link" which opens app correctly.
- With firebase_auth: ^0.20.0+1, link received in email is not a dynamic link, it opens in webpage and redirects to given URL within browser. 0.18.4+1 is the best we have for email link login now.
Is this intended behaviour? I am having similar problems. Our login with email link stopped working aswell.
No, it's not intended behaviour. Latest is broken for email link auth.
@wolframm
Are you still facing the issue ? Also, is your issue about email link sign-in
not working or about confusion as how exactly to implement email link sign-in or document not being clear about it ?
Can you also try the official firebase_auth
plugin example and check if using email with sign in link
functionality works using it ?
@darshankawar I don't see my job as debugging FlutterFire libs. So, I will work on other stuff for a couple of days and see if FlutterFire gets an update. If not, I will downgrade to firebase_auth 0.18.4+1, as suggested by @halildurmus and @sunil90210.
@wolframm I wasn't suggesting to debug the library but just to try out the official example and see if you get similar behavior using it, since the example also uses the latest version of the plugin.
I also had this issue and fiddled around with the library for a few hours. In iOS, it seems like the email is sent with a properly formatted dynamic link, and the library works fine. In Android, though, it's completely busted.
In FlutterFirebaseAuthPlugin.java, the function sendSignInLinkToEmail
does not properly use the ActionCodeSettings sent from the Flutter library. I had to manually create my own ActionCodeSettings by using the newBuilder()
function and construct a hard-coded ActionCodeSettings object. This, of course, ignored the ActionCodeSettings set from the Flutter application, but that was OK for me since I was able to hard-code it to my needs. Once I was using my own hard-coded ActionCodeSettings, the email was sent off properly and used a correctly-formatted dynamic link.
This suggests that the underlying issue is in the function getActionCodeSettings
or else in the Flutter library function formatting and passing the ActionCodeSettings to the Android library.
I was able to reproduce this on the latest master 1.26.0-13.0.pre.179
with
firebase_core: ^0.7.0
firebase_auth: ^0.20.0+1
firebase_dynamic_links: ^0.7.0+1
This is the code used to handle the link (not sure why this isn't in the official example, might make a PR for this).
The findings of @martyfuhry seem to be correct. The link generated on Android doesn't work on either Android or iOS.
However, I can't get links generated on either platform to work on Android. The link generated on iOS seems to just go through an extra redirect in the browser (to the continue URL) and then just opens that in the app. The link generated on Android just goes directly to the continue URL and doesn't work either. In both cases the result on Android is:
I/flutter (27832): [my continueURL] is not a valid email sign-in link
On iOS everything works fine if you complete the necessary setup in Xcode.
Facing the same issue.
Using the following versions:
firebase_core: ^0.7.0
firebase_auth: ^0.20.0+1
firebase_dynamic_links: ^0.7.0+1
The onSuccess or onError callbacks are not getting triggered after upgrading.
FirebaseDynamicLinks.instance.onLink(onSuccess: (PendingDynamicLinkData dynamicLink) async { ... }
I'm facing the same issue, Flutter 1.25.0-8.3.pre • channel beta
firebase_auth: ^0.20.0+1
firebase_dynamic_links: ^0.7.0+1
firebase_core: ^0.7.0
The onSuccess is getting triggered but the path and query params are empty so the Sign-In Email Link is not valid
dynamicLink?.link?.path is empty
dynamicLink?.link?.host is set to my domain
dynamicLink?.link?.queryParameters is empty
@russellwheatley Do you know if this is a fix we need to make in firebase_auth? If so, any idea which commit broke it? Been trying to hunt it down
Following up the post of @martyfuhry, I think the fix lies in the ActionCodeSettings.asMap method (in action_code_settings.dart). Everywhere it is consumed (Android/iOS/Web), it is assumed that the map looks like this:
{
'url': url,
'dynamicLinkDomain': dynamicLinkDomain,
'handleCodeInApp': handleCodeInApp,
'iOS': {
'bundleId': iOSBundleId,
},
'android': {
'packageName': androidPackageName,
'minimumVersion': androidMinimumVersion,
'installApp': androidInstallApp,
}
}
whereas the actual ActionCodeSettings mapping method is like this:
Map<String, dynamic> asMap() {
return <String, dynamic>{
'url': url,
'dynamicLinkDomain': dynamicLinkDomain,
'handleCodeInApp': handleCodeInApp,
'androidPackageName': androidPackageName,
'androidMinimumVersion': androidMinimumVersion,
'androidInstallApp': androidInstallApp,
'iOSBundleId': iOSBundleId,
};
}
Changing the map method to the following fixed it for my app:
Map<String, dynamic> asMap() {
return <String, dynamic>{
'url': url,
'dynamicLinkDomain': dynamicLinkDomain,
'handleCodeInApp': handleCodeInApp,
'iOS': {
'bundleId': iOSBundleId,
},
'android': {
'packageName': androidPackageName,
'minimumVersion': androidMinimumVersion,
'installApp': androidInstallApp,
}
};
}
}
I only tested it on Android, but If anyone need a quick fix, I implemented it here: https://github.com/jyardin/flutterfire/tree/email-link-signin-fix You can directly use it by adding the following to your pubspec overrides:
dependency_overrides:
firebase_auth_platform_interface:
git:
url: git://github.com/jyardin/flutterfire.git
ref: email-link-signin-fix
path: packages/firebase_auth/firebase_auth_platform_interface/
It is based on version 0.20.0+1 of firebase_auth package (so you must be on this version).
Tested on iOS and Android with firebase_auth package: ^0.20.0+1
. Looks like it's working! 🎉
Following up the post of @martyfuhry, I think the fix lies in the ActionCodeSettings.asMap method (in action_code_settings.dart). Everywhere it is consumed (Android/iOS/Web), it is assumed that the map looks like this:
{ 'url': url, 'dynamicLinkDomain': dynamicLinkDomain, 'handleCodeInApp': handleCodeInApp, 'iOS': { 'bundleId': iOSBundleId, }, 'android': { 'packageName': androidPackageName, 'minimumVersion': androidMinimumVersion, 'installApp': androidInstallApp, } }
whereas the actual ActionCodeSettings mapping method is like this:
Map<String, dynamic> asMap() { return <String, dynamic>{ 'url': url, 'dynamicLinkDomain': dynamicLinkDomain, 'handleCodeInApp': handleCodeInApp, 'androidPackageName': androidPackageName, 'androidMinimumVersion': androidMinimumVersion, 'androidInstallApp': androidInstallApp, 'iOSBundleId': iOSBundleId, }; }
Changing the map method to the following fixed it for my app:
Map<String, dynamic> asMap() { return <String, dynamic>{ 'url': url, 'dynamicLinkDomain': dynamicLinkDomain, 'handleCodeInApp': handleCodeInApp, 'iOS': { 'bundleId': iOSBundleId, }, 'android': { 'packageName': androidPackageName, 'minimumVersion': androidMinimumVersion, 'installApp': androidInstallApp, } }; } }
I only tested it on Android, but If anyone need a quick fix, I implemented it here: https://github.com/jyardin/flutterfire/tree/email-link-signin-fix You can directly use it by adding the following to your pubspec overrides:
dependency_overrides: firebase_auth_platform_interface: git: url: git://github.com/jyardin/flutterfire.git ref: email-link-signin-fix path: packages/firebase_auth/firebase_auth_platform_interface/
It is based on version 0.20.0+1 of firebase_auth package (so you must be on this version).
Awesome! I'll try it out. Wouldn't this break iOS since it was working before and we've changed it from the prefixed action code settings version to the map?
Confirmed @jonsaw's fix works for both iOS and Android. Thanks @jonsaw !!!
@danReynolds credit goes to @jyardin 😄
Observations:
1. With firebase_auth: ^0.18.4+1, link received in email is a valid "page.link" which opens app correctly. 2. With firebase_auth: ^0.20.0+1, link received in email is not a dynamic link, it opens in webpage and redirects to given URL within browser. 0.18.4+1 is the best we have for email link login now.
I had to revert back too. This kind of bugs really shouldn't happen in such a project!
Ah man I worked on Email Link Auth for a whole day and thought It's my fault not working. My project is currently on hold until this gets fixed. When would a new version be released?
I'm having same problem. Is the best solution to fall back to ^0.18.4+1 or use the solution from @jyardin ?
I followed these instructions on firebase.flutter.dev to implement email-link auth in my Flutter app. The mixture of Flutter-specific instructions with links to Firebase generic instructions is quite confusing. After spending multiple days, email-link sign in is still not working.
I successfully implemented email & password auth as well as Facebook auth using FlutterFire. My app is also successfully communicating with Firebase Firestore and Functions. I assume my project is setup correctly. I also implemented email link sign-in for my Firebase project's AngularFire web app without any issues.
Here is the method in my Flutter app that calls Firebase Auth:
Here is the function that is waiting to handle the sign-in link:
My app manages to call Firebase and an email is sent to my inbox with a sign-in link. When I click on the link in the Gmail app on my Android emulator, my app is moved to the foreground and it handles the link. The prints from
onLink
are:My dynamic link settings are as follows. However, I don't really understand what the purpose of this is. Doesn't Firebase Auth generate the necessary deep link data based on the ActionCodeSetting automatically (it does for AngularFire)? Not sure why I have to setup some dynamic link manually in the console.
Firebase Auth settings:
Flutter doctor output:
Pubspec yaml:
PLEASE HELP!