score:3
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);
}
Source: stackoverflow.com
Related Query
- Github oauth callback url is adding query string before hash
- Removing query string parameter from Url
- Sending URL Query String through Vue / Axios
- Vue/Vite router has /#/ which doesn't work with Oauth flow callback URL
- Cannot read query params becouse vue.js is adding #/ to the end of url
- How can I get query parameters from a URL in Vue.js?
- How to set URL query params in Vue with Vue-Router
- VueJs get url query
- Best Way to Pass Query Parameters to URL Using Axios in Vue?
- AWS Cognito UI uses a hash to include parameters when it calls the callback page
- Get URL query parameters in Vue 3 on Component
- Remove the # hash from URL when using Vue.js in Laravel Homestead
- Vue i18n - adding locale to the URL using routerview
- match vue js routes with query string in them?
- Read URL query param values (Vue.js)
- Is there any workaround for "NavigationDuplicated" exception in Vue.js when pushing query parameters in the url while remaining on the same path
- VueJS Adding data from query parameters
- After adding Global Route Guards in Vue Router the URL won't update anymore
- how to append multiple query parameters in url - NuxtJS
- Vue transition: v-on:before-leave hides element before callback executes
- How to get query from url and send it to Store at nuxt js project
- How to wait for an async call to finish in component's mount callback before unit testing it?
- How to use Vue router query params in hash mode?
- Auth0 callback URL for Vue/Quasar and Capacitor app
- Recommended way of waiting on an Apollo query before rendering the next page?
- How to add hash at end of URL when clicking on Bootrap-vue tabs?
- How to hold URL query params in Vue with Vue-Router
- Access the query string in VueJS
- storing url before going to new page with nuxt-link
- removing __typename field from urql query result before mutation
More Query from same tag
- Vue Jest testing an element's inline style
- How to use vue-datetime-picker in single file component
- How to style parent if child has class in vue?
- Div with fixed header, content scrollable while hovered over header
- Laravel 8 - Jetstream + inertia.js - Vue dev tools not working
- How to use multi range in between rule of VeeValidate
- Vue3: Check if event listener is bound to component instance
- Convert working VueJS component to ReactJS
- How to use the PrimeVue i18n integration?
- Vuejs change prop value in component from instance
- Nuxt access store (in Module mode) from JS file
- NavBar in Vue using v-for and router
- Vue JS - Add dynamic component based on dropdown selection
- How to Concat Arrays in Vuex getters
- pass parameter in URL using vuejs and laravel
- font-awesome in vue project is not working
- Vue Component- > Export default ... was not found in
- unable to run command ~$ vue add unit-mocha in vue cli 3
- Emit an event from electron main js into a vue component
- How to set focus on textarea which is rendered inside v-for in Vuejs 2?
- How to call a vue.js function on page load
- Right way to compose navigation links programatically with BootstrapVue
- Unexpected token import - jsfiddle
- Passing props from one component to another when the transition happens using router.push
- paramWatchers is not working
- Vue.js - Pagination
- How can you dynamically build router-links in Vue.js?
- VueJS 2.0 server-side rendering: How to get data only once using preFetch and beforeRouteEnter?
- Vue Js : form-data Event
- vuejs 2 axios put, delete