Guest User

Untitled

a guest
Jul 16th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. require "base64"
  2. require "jwt"
  3.  
  4. ISSUER_ID = "YOUR_ISSUER_ID"
  5. KEY_ID = "YOUR PRIVATE KEY ID"
  6.  
  7. private_key = OpenSSL::PKey.read(File.read('path_to_your_private_key XXXXXXXXXXXX.p8'))
  8.  
  9.  
  10. token = JWT.encode(
  11. {
  12. iss: ISSUER_ID,
  13. 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)
  14. 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.)
  15. },
  16. private_key,
  17. "ES256",
  18. header_fields={
  19. kid: KEY_ID }
  20. )
  21.  
  22. puts token
Add Comment
Please, Sign In to add comment