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

Fix: no more redirect on direct load / refresh of a page. #158

merged 1 commit into from Apr 27, 2018


None yet
4 participants

SnooHD commented Apr 26, 2018

If you load a page with auth directly from the URL bar (or refresh the page) you will allways be redirected to home. This is simply because the user gets re-logged in, and the watcher will trigger the loggedIn redirect.

Now, as soon as we move to another page, this.ctx.from is being added so we know the previous page.
This means that on the initial load, ctx.from is not avaible.

Because of that, a check in the watchState to see if ctx.from excists should disable the redirect only on first direct load of a page.

@pi0 pi0 merged commit 0386eb9 into nuxt-community:dev Apr 27, 2018


This comment has been minimized.


pi0 commented Apr 27, 2018


@SnooHD SnooHD deleted the SnooHD:auth-dev branch Apr 27, 2018


This comment has been minimized.

bigzs commented May 15, 2018

But the refresh is still redirected
tim 20180515163032
tim 20180515163050


This comment has been minimized.


SnooHD commented May 15, 2018

@bigzs i am unable to reproduce this..
For me this.ctx.from is undefined on refresh.


This comment has been minimized.

subsociety commented May 15, 2018

I can confirm @bigzs's behavior in Firefox. Direct page request or refresh after logging in, the this.ctx.from value is populated. Even when clicking a link within the site as an authenticated user is triggering a redirect. Perhaps I'm not following the intended behavior here?

In Chrome all works as expected.


This comment has been minimized.

bigzs commented May 16, 2018

@SnooHD @subsociety @pi0
I use Chrome


This comment has been minimized.


pi0 commented May 18, 2018

I've reverted this because not working and making unwanted behaviours. A reproduction repository would be much appreciated for a fix.

PS: I think this bug is probably because Cookies are not set and SSR side does not detect loggedIn status.

pi0 added a commit that referenced this pull request May 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment