1 Commits
ci=02 ... ci-03

Author SHA1 Message Date
efdea10b14 Guarantee req.oauth in APIRoute middleware
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2020-10-18 17:19:26 -05:00

View File

@@ -10,6 +10,7 @@ class APIRouteMiddleware extends Middleware {
if ( allow_user && req.is_auth ) { if ( allow_user && req.is_auth ) {
return next() return next()
} else if ( allow_token ) { } else if ( allow_token ) {
if ( !req.oauth ) req.oauth = {}
return req.app.oauth2.authorise()(req, res, async e => { return req.app.oauth2.authorise()(req, res, async e => {
if ( e ) return next(e) if ( e ) return next(e)
// Look up the OAuth2 client an inject it into the route // Look up the OAuth2 client an inject it into the route