Skip to content

Commit 03e7d0b

Browse files
author
Sachin Maheshwari
committed
relaxing current static token support.
1 parent eb2d0ef commit 03e7d0b

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ workflows:
8282
- "build-dev":
8383
filters:
8484
branches:
85-
only: ['dev']
85+
only: ['dev','feature/m2mtoken-support']
8686
- "build-prod":
8787
filters:
8888
branches:

common/helper.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,9 @@ function validateEventPayload (event) {
192192
function verifyTokenScope(req, scope) {
193193
const isMachineToken = _.get(req, 'authUser.isMachine', false);
194194
const scopes = _.get(req, 'authUser.scopes', []);
195-
if (isMachineToken && (_.indexOf(scopes, scope) >= 0)) {
196-
return true;
195+
if (isMachineToken && !(_.indexOf(scopes, scope) >= 0)) {
196+
throw createError.Unauthorized("Check your token scope.")
197197
}
198-
throw createError.Unauthorized("Check your token scope.")
199198
}
200199

201200
module.exports = {

0 commit comments

Comments
 (0)