fixed google

Signed-off-by: Yannick Bungers <git@innay.de>
Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
Yannick Bungers 2020-04-13 13:52:44 +02:00 committed by David Mehren
parent 83ef1de792
commit 992affae45
No known key found for this signature in database
GPG key ID: 6017AF117F9756CB

View file

@ -1,7 +1,7 @@
import { Router } from 'express' import { Router } from 'express'
import { AuthMiddleware } from '../interface' import { AuthMiddleware } from '../interface'
import passport from 'passport' import passport from 'passport'
import * as GoogleStrategy from 'passport-google-oauth20' import * as Google from 'passport-google-oauth20'
import {config} from '../../../config' import {config} from '../../../config'
import { passportGeneralCallback } from '../utils' import { passportGeneralCallback } from '../utils'
@ -9,7 +9,7 @@ const googleAuth = Router()
export const GoogleMiddleware: AuthMiddleware = { export const GoogleMiddleware: AuthMiddleware = {
getMiddleware (): Router { getMiddleware (): Router {
passport.use(new GoogleStrategy({ passport.use(new Google.Strategy({
clientID: config.google.clientID, clientID: config.google.clientID,
clientSecret: config.google.clientSecret, clientSecret: config.google.clientSecret,
callbackURL: config.serverURL + '/auth/google/callback', callbackURL: config.serverURL + '/auth/google/callback',
@ -17,7 +17,7 @@ export const GoogleMiddleware: AuthMiddleware = {
}, passportGeneralCallback)) }, passportGeneralCallback))
googleAuth.get('/auth/google', function (req, res, next) { googleAuth.get('/auth/google', function (req, res, next) {
const authOpts: GoogleStrategy.AuthtenticateOptionsGoogle = { scope: ['profile'], hostedDomain: config.google.hostedDomain } const authOpts = { scope: ['profile'], hostedDomain: config.google.hostedDomain }
passport.authenticate('google', authOpts)(req, res, next) passport.authenticate('google', authOpts)(req, res, next)
}) })
googleAuth.get('/auth/google/callback', googleAuth.get('/auth/google/callback',