Deep Linking, Login, and redirect

Is there a good example of using deep linking with ‘guards’ for logged in vs anon users? I’m having trouble piecing all of this together.

Here are the requirements I’m trying to implement:

  • Anonymous (non-logged in) should be directed to login page by default.
  • Logged in user will get many pages (data bound list in the side menu).
  • I want to allow deep links such as /customers/123. However if the user is not logged in, I need to redirect user to a login prompt with a return url (or nav params) to route them back to the original destination.
  • When user visits root (e.g. root of the site in browser, or when opening the mobile app), I want to change their default rootPage based on their logged in status… If they’re not already logged in, it should redirect to the login page. If already logged in, I’d like to load a (secured) page of their recent activity.

I’m deploying my app both a mobile app and the ‘browser’ platform as a web app (with some reduced functionality), hence the deep linking is an important feature.

Any examples or further documentation for how to wire up these features?

1 Like

I need this also. I’m using MS Adal Auth and need to redirect to a deep link after logging in. Right now you have to set the root nav and pass parameters to get it into the nav controller of a page, but how do you do that with a deep link URL? Do I parse it and match the segments with the pages then parse the parameters and create a data object with key value pairs based on the route definitions and the parameters passed? There has to be an easier way right?

@abaadmin did you ever find a solution to this?


No… got pulled off the project for a while

No I have not. This post is helpful though, I do not see how to get the query parameters:

DeepLinker access to config object