mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 05:53:19 +02:00
update oauth2 to get contact information (#673)
Signed-off-by: Denis barbaron <denis.barbaron@orange.com> Co-authored-by: Karol Wrótniak <karol.wrotniak@droidsonroids.pl>
This commit is contained in:
@@ -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()
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user