This commit is contained in:
3wc 2022-12-07 14:57:04 -08:00
parent 9c8d8c89ca
commit 67d0315917
1 changed files with 6 additions and 3 deletions

View File

@ -54,6 +54,8 @@ module.exports = exports = (log, loga, argv) ->
if argv.oauth2_CallbackPort?
callbackHost = callbackHost + ":" + argv.oauth2_CallbackPort
console.log "callbackHost", callbackHost
ids = []
#### Public stuff ####
@ -134,7 +136,7 @@ module.exports = exports = (log, loga, argv) ->
return false
switch idProvider
when "github", "google", "twitter", 'oauth2'
when "github", "google", "twitter", "oauth2"
if _.isEqual(admin[idProvider], req.session.passport.user[idProvider].id)
return true
else
@ -164,12 +166,13 @@ module.exports = exports = (log, loga, argv) ->
OAuth2Strategy = require('passport-oauth2').Strategy
oauth2StrategyName = callbackHost + 'OAuth'
console.log "callbackHost", callbackHost
if argv.oauth2_UserInfoURL?
OAuth2Strategy::userProfile = (accesstoken, done) ->
console.log "hello"
console.log accesstoken
@_oauth2._request "GET", argv.oauth2_UserInfoURL, null, null, accesstoken, (err, data) ->
console.log "data", data
console.log "err", err
if err
return done err
try