In the link below is explained how to generate JWT token with header and payload to access the Apple API
However I don't see how to combine header and payload.
Can someone make an example in ruby
Just use the jwt gem. It's a well-maintained library with regular updates. It's probably possible to do it without a gem too, but anything having to do with security should be air-tight in production, so I would just go with the gem.
Look for the correct encryption algorithm (Apple seems to be using ES256) and find it in the documentation to see an example of how to create a token with that.
The format for creating a basic JWT token with the gem (custom header fields are optional) is this:
发布评论
评论(1)
只需使用 jwt gem 。这是一个维护良好的图书馆,并定期更新。也许也可以没有宝石也可以做到这一点,但是与安全性有关的任何事情都应该在生产中是气密的,所以我只能选择宝石。
寻找正确的加密算法(Apple似乎正在使用ES256),并在文档中找到它,以查看如何使用该图表创建令牌的示例。
使用GEM创建基本JWT令牌的格式(自定义标头字段是可选的)是:
Just use the jwt gem. It's a well-maintained library with regular updates. It's probably possible to do it without a gem too, but anything having to do with security should be air-tight in production, so I would just go with the gem.
Look for the correct encryption algorithm (Apple seems to be using ES256) and find it in the documentation to see an example of how to create a token with that.
The format for creating a basic JWT token with the gem (custom header fields are optional) is this: