Utility Methods - Base64URL Encode
jwt-authn
base64URLEncode(json)
- 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