We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7aa886d commit 75aaaa6Copy full SHA for 75aaaa6
src/backend/src/services/WispService.js
@@ -57,10 +57,17 @@ class WispService extends BaseService {
57
const svc_apiError = this.services.get('api-error');
58
const svc_event = this.services.get('event');
59
60
- const decoded = svc_token.verify('wisp', req.body.token);
61
- if ( decoded.$ !== 'token:wisp' ) {
62
- throw svc_apiError.create('invalid_token');
63
- }
+ const decoded = (() => {
+ try {
+ const decoded = svc_token.verify('wisp', req.body.token);
+ if ( decoded.$ !== 'token:wisp' ) {
64
+ throw svc_apiError.create('invalid_token');
65
+ }
66
+ return decoded;
67
+ } catch (e) {
68
+ throw svc_apiError.create('forbidden');
69
70
+ })();
71
72
const svc_getUser = this.services.get('get-user');
73
0 commit comments