services/backend.js
// Verify the header and the enclosed JWT.
Verify the header and the enclosed JWT.
Verify the header and the enclosed JWT .
function verifyAndDecode (header) {
  if (header.startsWith(bearerPrefix)) {
    try {
      const token = header.substring(bearerPrefix.length);
      return jsonwebtoken.verify(token, secret, { algorithms: ['HS256'] });
    }
    catch (ex) {
      throw Boom.unauthorized(STRINGS.invalidJwt);
    }
  }
  throw Boom.unauthorized(STRINGS.invalidAuthHeader);
}
function verifyAndDecode ( header ) { if ( header . startsWith ( bearerPrefix ) ) { try { const token = header . substring ( bearerPrefix . length ) ; return jsonwebtoken . verify ( token , secret , { algorithms : [ 'HS256' ] } ) ; } catch ( ex ) { throw Boom . unauthorized ( STRINGS . invalidJwt ) ; } } throw Boom . unauthorized ( STRINGS . invalidAuthHeader ) ; }
Verify the header and the enclosed JWT.
Verify the header and the enclosed JWT .