'auto_route redirect with declarative routes

I have an iOS app with auto_route which uses declarative routes as in this example for the root router: https://autoroute.vercel.app/advanced/authentication. I use a custom protocol deep link to redirect to the app from an oAuth authentication.

Problem is now that I cannot use a route guard to intercept the deep link coming in because route guards are not allowed with declarative routing.

The solution that I have found is to use the info in AppRouter().routeInfoProvider().value.location in the code that I pass to the routes parameter of AppRouterDelegate.declarative as in the above mentioned example. Is that a sensible solution?



Solution 1:[1]

You can simply use route guards throughout(even for your oAuth flow), because I think using declarative and route guards can make your implementations inconsistent. The declarative example was provided as a simpler and easy-to-understand alternative to using route guards. Thank you.

https://autoroute.vercel.app/advanced/route_guards

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gideon Oyekale