Callback does not work
shanematte opened this issue · 0 comments
shanematte commented
Hello!
A lot of time has been spent, but I do not understand what the matter is.
redirect link
"callback?code=4/here_is_the_token#"
app.js
import passport from 'koa-passport'
const app = new Koa()
app.keys = ['secret']
app.use(session(app))
app.use(bodyParser())
import './helpers/auth'
app.use(passport.initialize())
app.use(passport.session())
app.use(routes)
auth.js
import passport from 'koa-passport'
import googleStrategy from 'passport-google-oauth20'
import { users } from '../models/index'
import config from 'config'
const googleMain = new googleStrategy({
clientID: config.get('oauth.clientID'),
clientSecret: config.get('oauth.clientSecret'),
callbackURL: config.get('oauth.callbackURL')
}, (accessToken, refreshToken, profile, done) => {
//is not called
console.log(profile)
return done(null, profile)
})
passport.use(googleMain)
auth.routes.js
import Router from 'koa-router'
import auth from '../actions/auth.actions'
import passport from 'koa-passport'
const router = new Router({prefix:'/auth'})
router.get('/google', passport.authenticate('google', {
scope: ['profile']
}))
router.get('/google/callback', (ctx, next)=>{
console.log('redirect')
})
export default router.routes()
Tell me, what's the problem? Why the callback is not called