mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 17:55:17 -04:00
Move old backend code to old_src folder
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
c42d2223e8
commit
7b9f9a487b
97 changed files with 7 additions and 7 deletions
31
old_src/lib/web/auth/facebook/index.ts
Normal file
31
old_src/lib/web/auth/facebook/index.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
import passport from 'passport'
|
||||
import { config } from '../../../config'
|
||||
import { AuthMiddleware } from '../interface'
|
||||
import { Router } from 'express'
|
||||
import { passportGeneralCallback } from '../utils'
|
||||
import { Strategy as FacebookStrategy } from 'passport-facebook'
|
||||
|
||||
export const FacebookMiddleware: AuthMiddleware = {
|
||||
getMiddleware (): Router {
|
||||
const facebookAuth = Router()
|
||||
passport.use(new FacebookStrategy({
|
||||
clientID: config.facebook.clientID,
|
||||
clientSecret: config.facebook.clientSecret,
|
||||
callbackURL: config.serverURL + '/auth/facebook/callback'
|
||||
}, passportGeneralCallback
|
||||
))
|
||||
|
||||
facebookAuth.get('/auth/facebook', function (req, res, next) {
|
||||
passport.authenticate('facebook')(req, res, next)
|
||||
})
|
||||
|
||||
// facebook auth callback
|
||||
facebookAuth.get('/auth/facebook/callback',
|
||||
passport.authenticate('facebook', {
|
||||
successReturnToOrRedirect: config.serverURL + '/',
|
||||
failureRedirect: config.serverURL + '/'
|
||||
})
|
||||
)
|
||||
return facebookAuth
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue