asdasd

sdsd
mail@pastecode.io avatar
unknown
abc
2 years ago
412 B
3
Indexable
Never
require 'jwt'
key_file = 'key.p8'
team_id = ''
client_id = ''
key_id = ''
ecdsa_key = OpenSSL::PKey::EC.new IO.read key_file
headers = {
    kid: key_id
}
claims = {
        iss: team_id,
        iat: Time.now.to_i,
        exp: Time.now.to_i + 86400*180,
        aud: 'https://appleid.apple.com',
        sub: client_id,
}
token = JWT.encode claims, ecdsa_key, 'ES256', headers

puts token