Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirection QueryParams are lost after upgrading to 9.3.0+1 #2143

Open
diego-poncedeleon-pockit opened this issue Jan 28, 2025 · 0 comments
Open

Comments

@diego-poncedeleon-pockit

Started happening on migration from 8.3.0 to 9.3.0+1

RedirectRoute(path: '/magic-link', redirectTo: '/login'),
AutoRoute(
  path: '/login',
  page: LoginRoute.page,
  initial: true,
),

My login page:

@RoutePage()
class LoginPage extends StatefulWidget {
  final String? token;
  final void Function(bool)? pendingNavigationCallback;

  const LoginPage({
    super.key,
    @QueryParam("token") this.token,
    this.pendingNavigationCallback,
  });

  @override
  State<LoginPage> createState() => _LoginPageState();
}

Deeplink: sample:

http://whatever.com/magic-link?token=something

Result:

Login page is opened but token is always null.

My current workaround:

FutureOr<DeepLink> deeplinkBuilder(PlatformDeepLink deeplink) {
    // auto_route redirection is losing the query parameters completely (on latest version),
    // so we need to handle the magic link redirection manually
    if (deeplink.uri.path == "/magic-link") {
      final token = deeplink.uri.queryParameters["token"];
      return DeepLink.single(LoginRoute(token: token));
    }

    saveCurrentDeeplink(deeplink.uri);
    return deeplink;
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant