Skip to content

Bren2010/cf-access-jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

No packages published