Guarantee req.oauth in APIRoute middleware
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
Garrett Mills 2020-10-18 17:19:26 -05:00
parent ce7349565e
commit efdea10b14
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

View File

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