Files
passport-jwt/lib/auth_header.ts
2022-09-09 19:04:04 +02:00

10 lines
268 B
TypeScript

const HdrRegex = /(\S+)\s+(\S+)/;
export function parseAuthHeader(hdrValue?: string) {
if (typeof hdrValue !== 'string') {
return null;
}
const matches = hdrValue.match(HdrRegex);
return matches && { scheme: matches[1], value: matches[2] };
}