score:3

Accepted answer

github is probably messing things up because of the #. as a workaround you may make github redirect to another endpoint, say www.yourhost.com/api/v1/redirect-to-home?code=abcde (with no # in it), and there you correctly redirect to https://myapp.com/#/something?code=abcde.

score:1

github is doing the correct thing here, because oauth works with the query part of the url, and doesn't change the anchor.

what you can do is detecting and manually adjusting the url in your boot process, this can be done as follows:

inside your main bootstrap.js (the file where you do new vue) file, you can manually detect this anchor, and update the path, before vue loads.

this can be accomplished by checking window.location from the bootstrap file, and then calling window.location.href.replace to replace the url without an visible redirect:

// getparameterbyname from https://stackoverflow.com/a/901144/1542723 
function getparameterbyname(name, url) {
    if (!url) url = window.location.href;
    name = name.replace(/[\[\]]/g, "\\$&");
    var regex = new regexp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
        results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeuricomponent(results[2].replace(/\+/g, " "));
}

const code = getparameterbyname('code');
if(code) {
    const l = window.location;
    window.location.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname + '123#' + l.hash + '?code=' + code);
}

Related Query

More Query from same tag