flutter firebase reset password without dynamic links - Stack Overflow

admin2025-04-16  4

In my app I use this code to send reset email link to user email:

Future<BaseResponse<bool, BaseError>> sendResetPasswordLink(
  String email,
) async {
  try {
    // await _auth.sendPasswordResetLink(email);

    var acs = ActionCodeSettings(
      // URL you want to redirect back to.
      // URL must be whitelisted in the Firebase Console.
      url: 'example',
      // dynamicLinkDomain: 'example',
      // Must be true for app handling
      handleCodeInApp: true,
      androidMinimumVersion: '1',
      androidPackageName: 'com.example.app',
      iOSBundleId: 'com.example.app',
    );

    await FirebaseAuth.instance
        .sendPasswordResetEmail(email: email, actionCodeSettings: acs);

    return BaseResponsepleted(
      true,
    );
  } catch (e) {
    return BaseResponse.error(BaseError(message: 'unknown error'));
  }
}

I don't want to use firebase dynamic links for redirecting to my app. Is there any way to do this redirection without FDL?

In my app I use this code to send reset email link to user email:

Future<BaseResponse<bool, BaseError>> sendResetPasswordLink(
  String email,
) async {
  try {
    // await _auth.sendPasswordResetLink(email);

    var acs = ActionCodeSettings(
      // URL you want to redirect back to.
      // URL must be whitelisted in the Firebase Console.
      url: 'example',
      // dynamicLinkDomain: 'example',
      // Must be true for app handling
      handleCodeInApp: true,
      androidMinimumVersion: '1',
      androidPackageName: 'com.example.app',
      iOSBundleId: 'com.example.app',
    );

    await FirebaseAuth.instance
        .sendPasswordResetEmail(email: email, actionCodeSettings: acs);

    return BaseResponse.completed(
      true,
    );
  } catch (e) {
    return BaseResponse.error(BaseError(message: 'unknown error'));
  }
}

I don't want to use firebase dynamic links for redirecting to my app. Is there any way to do this redirection without FDL?

Share Improve this question edited Feb 2 at 15:15 Frank van Puffelen 601k85 gold badges890 silver badges860 bronze badges Recognized by Google Cloud Collective asked Feb 2 at 15:07 amirhossein ghabeliamirhossein ghabeli 477 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Dynamic links are not required for password reset to function. You can just send the email without a continue URL, let the user click the link, reset the password in the web page, and stay there.

Alternatively you can pass a continue URL, but that doesn't have to point to Firebase Dynamic Links. You can pass any URL you like, including one that you handle yourself without Firebase Dynamic Links.

转载请注明原文地址:http://anycun.com/QandA/1744796885a87750.html