Skip to content

Commit

Permalink
update oauth2 to get contact information (openstf#673)
Browse files Browse the repository at this point in the history
Signed-off-by: Denis barbaron <[email protected]>
Co-authored-by: Karol Wrótniak <[email protected]>
  • Loading branch information
denis99999 and koral-- authored Jun 13, 2023
1 parent 0749b55 commit b037a10
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/units/auth/oauth2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ var urlutil = require('../../../util/urlutil')
var jwtutil = require('../../../util/jwtutil')
var Strategy = require('./strategy')

const dbapi = require('../../../db/api')

module.exports = function(options) {
var log = logger.createLogger('auth-oauth2')
var app = express()
Expand All @@ -16,6 +18,24 @@ module.exports = function(options) {
app.set('strict routing', true)
app.set('case sensitive routing', true)

app.get('/auth/contact', function(req, res) {
dbapi.getRootGroup().then(function(group) {
res.status(200)
.json({
success: true
, contact: group.owner
})
})
.catch(function(err) {
log.error('Unexpected error', err.stack)
res.status(500)
.json({
success: false
, error: 'ServerError'
})
})
})

function verify(accessToken, refreshToken, profile, done) {
done(null, profile)
}
Expand Down

0 comments on commit b037a10

Please sign in to comment.