How to create a JWT for use with Apple Music
I used this script and it works perfectly
https://github.com/pelauimagineering/apple-music-token-generator
Creating A Developer Token For Apple Music API
I ran into the same problem, make sure your AuthKey.p8 file has the key on one line.
Yours looks like this:
-----BEGIN PRIVATE KEY-----
asdfg1rty5GSM49AgEGCCqGSM49AwEHBHkwdwIBAQQguWRXMHYkuFImkMGByqEPT
jaXQyO0WK1BjYpuDxIgNQ5nHRRFCuUOi8mgCgYIKoZIzj0DAQehcp0+Z+jwRANCAA
RCBFg8fL08QS36Fb8HmY+eFrDWMO00w5unCo5n8VyLhvttIZeByXlVsJrK/L3f/
F2wYmZme
-----END PRIVATE KEY-----
When it should look like this:
-----BEGIN PRIVATE KEY-----
asdfg1rty5GSM49AgEGCCqGSM49AwEHBHkwdwI...
-----END PRIVATE KEY-----
Generating a JWT for Apple's DeviceCheck API
According to: https://www.rfc-editor.org/rfc/rfc7519#section-4.1.6
val builder = Jwts
.builder()
.setHeaderParam("kid", "<key-id-from-file>")
.signWith(SignatureAlgorithm.ES256, privateKey)
.claim("iss", "<team-id>")
.claim("iat", System.currentTimeMillis()) // <--- Should be seconds, not milliseconds
Related Topics
Sending Http Post Request in Ruby by Net::Http
How to Connect to a Mongodb from Ruby Code
Error While Installing Ruby 1.9.3
Zip Up All Paperclip Attachments Stored on S3
Can't Install Rmagick and Imagemagick on Windows 7
Getting All Links of a Webpage Using Ruby
E: Unable to Locate Package Heroku-Toolbelt
How to Retrieve Exif Information of an Image in Rails
How to Do Complex Querying with Logical Operations by Using Searchkick
Ruby on Rails Looks for CSS in Assets Instead of Public/Stylesheets
How to Run Ruby in Haml in JavaScript Definition
Cloning an Array with Its Content
Postgresql Ilike with Multiple Matches in Rails Activerecord
What's the Best Way to Start a Background Process, That Can Get Accessed Later On
How to Find .Index of a Multidimensional Array