added another place in token to find grants in tokens

This commit is contained in:
tigerbot 2017-08-11 18:13:48 -06:00
parent fa3816390b
commit dae941323b
1 changed files with 4 additions and 3 deletions

View File

@ -280,12 +280,13 @@ module.exports.create = function (xconfx, apiFactories, apiDeps) {
res.send({ error: { message: "You must be logged in", code: "E_NO_AUTHN" } });
return;
}
if ('string' !== typeof req.oauth3.token.scp) {
res.send({ error: { message: "Token must contain a grants string in 'scp'", code: "E_NO_GRANTS" } });
var scope = req.oauth3.token.scope || req.oauth3.token.scp || req.oauth3.token.grants;
if ('string' !== typeof scope) {
res.send({ error: { message: "Token must contain a grants string in 'scope'", code: "E_NO_GRANTS" } });
return;
}
tokenScopes = req.oauth3.token.scp.split(/[,\s]+/mg);
tokenScopes = scope.split(/[,\s]+/mg);
if (-1 !== tokenScopes.indexOf('*')) {
// has full account access
next();