Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "base64"
- require "jwt"
- ISSUER_ID = "YOUR_ISSUER_ID"
- KEY_ID = "YOUR PRIVATE KEY ID"
- private_key = OpenSSL::PKey.read(File.read('path_to_your_private_key XXXXXXXXXXXX.p8'))
- token = JWT.encode(
- {
- iss: ISSUER_ID,
- iat: XXXXXXXXXX, (registered claim key, whose value indicates the time at which the token was generated, in terms of the number of seconds since Epoch, in UTC)
- exp: XXXXXXXXXX (registered claim key, whose value must not be greater than 15777000 (6 months in seconds) from the Current Unix Time on the server.)
- },
- private_key,
- "ES256",
- header_fields={
- kid: KEY_ID }
- )
- puts token
Add Comment
Please, Sign In to add comment