Skip to content

Tiny lib for verifying Cloudflare Access JWTs.

License

Notifications You must be signed in to change notification settings

PrimaryKids/cf-access-jwt

 
 

Repository files navigation

cf-access-jwt

Tiny lib for decoding Cloudflare Access JWTs and verifying signatures, using native crypto APIs.

Currently supports alg:'RS256' only.

const jwt = request.headers.get('Cf-Access-Jwt-Assertion');

const result = await parseJwt(jwt, issuer, audience);
if (!result.valid) {
  console.log(result.reason); // Invalid issuer/audience, expired, etc
} else {
  console.log(result.payload); // { iss, sub, aud, iat, exp, ...claims }
}

Code shamelessly stolen from: https://github.com/cfworker/cfworker/

About

Tiny lib for verifying Cloudflare Access JWTs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • TypeScript 100.0%