I'm using an oauth provider that forwards a token to an URL like this ?#access_token=TOKEN
So if I set the oauth redirect url to
https://vueapp/#!/oauth
I end up with
https://vueapp/?#access_token=TOKEN
and loose my oauth route. I've tried all tricks in the book but can't figure it out.
How do I deal with this in vue? Do I have to configure nginx to make it work? Thanks so much!
You probably shouldn't use hash mode for redirects like this, because the redirect hash overrides your routing hash.
Use history: true to use HTML5 history mode. And configure nginx appropriately.
The rewrite method linked in the Docs forwards app.js to index.html and breaks the app, what worked for me is try_files $uri $uri/ /index.html =404;, maybe add this to the Docs to save someone else a night of trial and error :-)
location / {
root /home/www;
include /etc/nginx/mime.types;
try_files $uri $uri/ /index.html =404;
}
There is no mean to make this work while using npm run dev ?
@yyx990803 is this solution current?
@yyx990803 is this solution current?
No. As of now you need to use mode: 'history' instead of history: true but otherwise things work once you use history mode. Configuring the server to send index.html (or your SPA URL) is critical as well. Superstatic can do this for testing.
Most helpful comment
You probably shouldn't use hash mode for redirects like this, because the redirect hash overrides your routing hash.
Use
history: trueto use HTML5 history mode. And configure nginx appropriately.