Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
updates d123eb8 Jun 7, 2019
1 contributor

Users who have contributed to this file

22 lines (15 sloc) 614 Bytes
require 'jwt'
# Save your private key from Apple in a file called `key.txt`
ecdsa_key = OpenSSL::PKey::EC.new IO.read 'key.txt'
headers = {
'kid' => '' # Find the 10-char Key ID value from the portal
}
claims = {
'iss' => '', # Your 10-character Team ID
'iat' => Time.now.to_i,
'exp' => Time.now.to_i + 86400*30, # This will be valid for 30 days
'aud' => 'https://appleid.apple.com',
'sub' => '', # Your Services ID, e.g. com.aaronparecki.services
}
token = JWT.encode claims, ecdsa_key, 'ES256', headers
puts token
You can’t perform that action at this time.