Reputation: 13
I've been able to successfully setup multiple Ember applications with shared Ember Simple Auth cookie based authentication. The next step of my journey is to setup proper redirects between applications. Hear me out.
domain.com/deep/link/resource
domain.com/login
to login via single sign-on component that uses Ember Simple Auth to save cookie with tokendomain.com/deep/link/resource
via previous transition app-b.domain.com/deep/link/resource
app-b.domain.com/deep/link/resource
routeapp-a.domain.com/deep/link/resource
domain.com/login
to login via single sign-on component that uses Ember Simple Auth to save cookie with tokenapp-a.domain.com/deep/link/resource
via previous transition on app-a
subdomainAny help or guidance would be much appreciated. I wonder if I can achieve Scenario C with Ember Simple Auth only, or if I need to write custom redirect logic in beforeModel
on subdomains, etc.
Upvotes: 1
Views: 307
Reputation: 4062
You'll be able get scenario C working by overriding the AuthenticatedRouteMixin
's beforeModel
method. That will by default to an (Ember.js) transition to the login route but in your case you want sth. like window.location.replace('domain.com/login')
and remember the current URL in a cookie or so. In order to redirect to app-a.domain.com/deep/link/resource
after the user logged in you'll need to override the ApplicationRouteMixin
's sessionAuthenticated
method so that it redirects to the previous URL remembered in the cookie if that's present and falls back to the default behavior if not.
Overall, getting this to work should be pretty straight forward actually following these steps.
Upvotes: 0