lib/oauth2.js
function (req, res, next) {
            if (options.forceAuthorize) {
                return next();
            }
            var userId = req.oauth2.user.id;
            var clientId = req.oauth2.client.id;
            var scope = req.oauth2.req.scope;
            models.Permissions.isAuthorized(clientId, userId, scope,
                function (err, authorized) {
                    if (err) {
                        return next(err);
                    } else if (authorized) {
                        req.oauth2.res = {};
                        req.oauth2.res.allow = true;
                        server._respond(req.oauth2, res, function (err) {
                            if (err) {
                                return next(err);
                            }
                            return next(new AuthorizationError('Unsupported response type: '
                                + req.oauth2.req.type, 'unsupported_response_type'));
                        });
                    } else {
                        next();
                    }
                });
        }
function (req, res, next) {
            if (options.forceAuthorize) {
                return next();
            }
            var userId = req.oauth2.user.id;
            var clientId = req.oauth2.client.id;
            var scope = req.oauth2.req.scope;
            models.Permissions.isAuthorized(clientId, userId, scope,
                function (err, authorized) {
                    if (err) {
                        return next(err);
                    } else if (authorized) {
                        req.oauth2.res = {};
                        req.oauth2.res.allow = true;
                        server._respond(req.oauth2, res, function (err) {
                            if (err) {
                                return next(err);
                            }
                            return next(new AuthorizationError('Unsupported response type: '
                                + req.oauth2.req.type, 'unsupported_response_type'));
                        });
                    } else {
                        next();
                    }
                });
        }
function ( req , res , next ) { if ( options . forceAuthorize ) { return next ( ) ; } var userId = req . oauth2 . user . id ; var clientId = req . oauth2 . client . id ; var scope = req . oauth2 . req . scope ; models . Permissions . isAuthorized ( clientId , userId , scope , function ( err , authorized ) { if ( err ) { return next ( err ) ; } else if ( authorized ) { req . oauth2 . res = { } ; req . oauth2 . res . allow = true ; server . _respond ( req . oauth2 , res , function ( err ) { if ( err ) { return next ( err ) ; } return next ( new AuthorizationError ( 'Unsupported response type: ' + req . oauth2 . req . type , 'unsupported_response_type' ) ) ; } ) ; } else { next ( ) ; } } ) ; }
Check if the user has granted permissions to the client app
Check if the user has granted permissions to the client app