'How to handle github oauth response after github login?
I have a Vuejs app that uses Github oauth to login. My current html exposes a button that logs in using github oauth. In this code when I click the button the Github oauth authorization dialog opens and is authorized. It then returns to my html app and I see a error in chrome console:
VM86700:1 POST http://localhost:3000/auth/github net::ERR_CONNECTION_REFUSED
The following is my config and is based from [vue-authenticate][1]:
import Vue from 'vue'
import App from './App.vue'
//import Vuex from 'vuex'
import VueAxios from 'vue-axios'
import VueAuthenticate from 'vue-authenticate'
import axios from 'axios';
import VueRouter from 'vue-router'
import cors from 'cors'
import vuetify from './plugins/vuetify';
const Home = { template: '<div>Home</div>' }
const router = new VueRouter({
mode: 'history',
routes: [
{ path: '/auth/github', component: Home },
]
})
Vue.use(VueAxios, axios)
Vue.use(VueAuthenticate, {
baseUrl: 'http://localhost:3000', // Your API domain
providers: {
github: {
clientId: '<REDACTED>',
redirectUri: 'http://localhost:8080/auth/callback' // Your client app url
}
}
})
Vue.config.productionTip = false
Vue.use(cors)
new Vue({
router,
vuetify,
render: h => h(App)
}).$mount('#app')
Vue.use(VueRouter)
It seems like I need a handler to handle this redirection from github `http://localhost:3000/auth/github` but not sure how that is done.
[1]: https://github.com/dgrubelic/vue-authenticate
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
