okta / samples-js-vue

samples-js-vue
https://github.com/okta/samples-js-vue
Other
57 stars 63 forks source link

implicit/ballback throws 404 error in dist version #75

Closed MikeSpencer42 closed 4 years ago

MikeSpencer42 commented 4 years ago

If I build the custom-login version of the project (via npm run build) and then run a local http instance out of the dist folder (using Node's http-server), the project loads as expected. However, when I try to login, the /implicit/callback route throws a 404 error and the app fails to load.

implict-callback-404

This also happens in my own project (which draws largely on this one). I haven't deployed it an actual server yet, but I need to do that soon and I'm worried that this issue will occur when I do.

Does anyone know why this is happening or how to handle this behavior?

shuowu commented 4 years ago

@MikeSpencer42 You will need to serve your app as a SPA app, but not a plain HTTP server, since there is no /implicit/callback actually there. By a quick search, I don't see how to set it up in http-server, but google suggested me another module which you may can give a try. https://www.npmjs.com/package/http-server-spa

MikeSpencer42 commented 4 years ago

@shuowu That makes sense. I've had luck with http-server in the past, but I now realize that I hadn't been using history mode in those apps. I ended up using servor to serve the app locally and it worked great. Thanks for the help!