I'm trying to implement Oauth (using Github) in a Vue project and when my callback url gets called from github it's appending the query string ?code=something before the hash from the url.
For example if I load https://myapp.com in a browser and click my login link <a href="https://github.com/login/oauth/authorize?scope=user:email&client_id=1234j1234jk&redirect_uri=https://myapp.com/#/something">Login</a> I get redirected to https://myapp.com/?code=asdfasdf#/something which means that this.$route.query is empty.
Being a rookie to both Vue and Oauth, how can I get around this issue so that when my callback gets called it goes to https://myapp.com/#/something?code=asdfadsf so that this.$route.query will contain the code?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With