Getting URL from Ember Router Transition for SSO Login

In my Ember App, I’m using the recommended beforeModel hook to redirect an unauthenticated user to the login page. I’m storing the transition and calling transition.retry() after a successful login. All as recommended by the guide: Preventing and Retrying Transitions - Routing - Ember Guides

But in order to support OAuth and SAML SSO login routines I need to support briefly navigating away from the app and provide a redirect URL for successfully login (the URL for the transition that was canceled).

I saw the transition has an intent and that intent has a url (retryTransition.intent.url) which looks like the right value, but my question is is that public? Can I use that safely or is there another way to do this?

1 Like

Apologies for opening up such an old topic but I have run into this problem as well. In order to authenticate via an OAuth server (Keycloak in my case) I too need to provide a redirect url for the server to use when redirecting back to the Ember app.

I have figured out how to make this work by inspecting either the ‘transition.intent.url’ and using that if it exists, or, if it doesn’t, by calling ‘generateURL(routeName, models, queryParams)’ on the (private) routing service with parameters scraped out of the transition. But using private methods and services is obviously not ideal and is, I suspect, very fragile. Is there a better way to do this that I have missed ?

Hi, I’m doing exactly the same as you describe in a production application without any problems. From what I’ve read I don’t think the routing service will be going away.