-
Notifications
You must be signed in to change notification settings - Fork 606
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
attemptedTransition is never persisted #1559
Comments
|
We are having the same issue in connection with the Auth0 addon. If it is not possible to persist and restore the 'attemptedTransition' could you please explain to the this line @marcoow https://github.com/simplabs/ember-simple-auth/blob/master/addon/mixins/authenticated-route-mixin.js#L89 ? Isn't that what this line should do? Or do you save the redirect url somewhere else? |
@deepflame: that line sets the |
@marcoow thanks for the swift reply! I guess what our problem is is that the app redirects to the auth provider (in our case Auth0) and then restarts the whole app when it comes back with a token in the URL for authentication. To solve this case I should just use the code in the fastboot case ( https://github.com/simplabs/ember-simple-auth/blob/master/addon/mixins/authenticated-route-mixin.js#L84-L87 ). I will try this in connection with the Auth0 addon and fix it there. This is probably better than persisting sessions for all ember-simple-auth users. |
Sure, you can always just override |
Maybe this is helpful for anyone. I was overriding beforeModel(transition) {
if (!this.get('session.isAuthenticated')) {
const fastboot = getOwner(this).lookup('service:fastboot');
const cookies = getOwner(this).lookup('service:cookies');
const protocol = (() => {
if (this.get('_isFastBoot')) {
return fastboot.get('request.protocol');
} else {
return window.location.protocol.replace(/:/, '');
}
})();
cookies.write('ember_simple_auth-redirectTarget', transition.intent.url, {
path: '/',
secure: protocol === 'https'
});
this.triggerAuthentication();
} else {
return this._super(...arguments);
}
}, Seems to work fine. |
How to reproduce in dummy project:
Protected Page
linkCTRL
+F5
to force Ember reload/
instead of/protected
Tested on Opera, Chrome and Firefox.
Probably the reason is that
attemptedTransition
is never persisted, it's easy to verify that inspecting theLocalStorage
(or the cookies).Furthermore I've tried to save by myself the
attemptedTransition
into the storage but it fails due to a circular reference.The text was updated successfully, but these errors were encountered: