less than 1 minute read

npm npm bundle size codesize npm NPM GitHub Sponsors GitHub Repo stars GitHub forks GitHub watchers Rate on Openbase link to npm

jwt-authn

base64URLEncode(json)

Full Documentation

  • json: the input in JSON object format.

Use to create the base64url encoding of the the input.

import { base64urlEncode } from "jwt-authn";

const payload = {
  iss: "joe",
  exp: 1300819380,
  "http://example.com/is_root": true,
}

base64URLEncode(payload);

// expected output:
// eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ