mirror of
https://github.com/HeyPuter/puter.git
synced 2025-01-23 06:00:21 +08:00
fix: improper 500 in wisp token verify
This commit is contained in:
parent
7aa886d573
commit
75aaaa66a8
@ -57,10 +57,17 @@ class WispService extends BaseService {
|
||||
const svc_apiError = this.services.get('api-error');
|
||||
const svc_event = this.services.get('event');
|
||||
|
||||
const decoded = svc_token.verify('wisp', req.body.token);
|
||||
if ( decoded.$ !== 'token:wisp' ) {
|
||||
throw svc_apiError.create('invalid_token');
|
||||
}
|
||||
const decoded = (() => {
|
||||
try {
|
||||
const decoded = svc_token.verify('wisp', req.body.token);
|
||||
if ( decoded.$ !== 'token:wisp' ) {
|
||||
throw svc_apiError.create('invalid_token');
|
||||
}
|
||||
return decoded;
|
||||
} catch (e) {
|
||||
throw svc_apiError.create('forbidden');
|
||||
}
|
||||
})();
|
||||
|
||||
const svc_getUser = this.services.get('get-user');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user