quasar dev mod_rewrite equilivant



  • Hi,
    I have a second problem when getting google auth to call back to the quasar site.

    google auth won’t accept localhost:8080/#/auth/google as a redirect url.
    It complains about the #
    So I am trying to get the ‘quasar dev’ command to redirect a request to localhost:8080/auth/google to localhost:8080/#/auth/google

    This is only a dev machine so no apache or ngnix in front of the server.

    Is there a way to do this?

    One idea I have is to have a beforeEnter: handler connected to ‘/’ This is being called.
    If I can determine the URL inside this function I should be able to write an if statement to do the redirection:

    I have the following function :
    function requireAuth (to, from, next) {
    console.log(‘requireAuth’)
    console.log(to)
    console.log(from)
    console.log(next)
    // Other code removed
    }

    It is picked up however none of the to, from and next parameters contain the url path of the incoming request. (I am going to localhost:8080/auth/google)

    It might be possible for me to do something like

    if (incommingURL === ‘/auth/google’) {
    next({
    path: ‘/auth/google’,
    query: { redirect: to.fullPath }
    })
    }

    Would this work? Would this preserve other parameters passed in the URL. (I need the token that google is passing me)


  • Admin

    The difference between an URL with hash (#/auth/google - notice the hash symbol at beginning) or with paths (like /auth/google) is how you configure the Vue Router: on hash mode or history mode.

    So, read about Vue Router: https://router.vuejs.org/en/essentials/history-mode.html
    And read about what changing from one mode (default is hash mode) to another (you probably want history mode) might affect the way Webpack handles static assets: http://quasar-framework.org/guide/app-handling-static-assets.html

    Basically when running the dev server, you are running an express instance (see /build/script.dev.js). Change whatever you see fit in /build to match your requirements.


Log in to reply
 

Looks like your connection to Quasar Framework was lost, please wait while we try to reconnect.