首先准备材料
1567492067694-2bd975c5-3dd0-4725-9a81-8960bce2d691.png
1567492187716-f66ba032-f196-457e-ba27-f810b7a43c8e.png
1567492229146-a5c3c87e-ea41-47c1-9dc0-2b21b1c7191f.png
下载key文件后要注意保留下来,只能下载唯一一次
现在有这些东西就可以开始配置client_secret.
1.首先要安装ruby
这里放个网址,大家按照步骤就可以了
https://www.jianshu.com/p/c073e6fc01f5
2.开始创建文件
创建文件所在的文件夹
cd '文件夹路径'
touch secret_gen.rb
这个步骤完成后就可以看到文件夹有个文件,点击进去
require "jwt"
key_file = "Path to the private key"
team_id = "Your Team ID"
client_id = "Your App Bundle ID"
key_id = "The Key ID of the private key"
validity_period = 180 # In days. Max 180 (6 months) according to Apple docs.
private_key = OpenSSL::PKey::EC.new IO.read key_file
token = JWT.encode(
{
iss: team_id,
iat: Time.now.to_i,
exp: Time.now.to_i + 86400 * validity_period,
aud: "https://appleid.apple.com",
sub: client_id
},
private_key,
"ES256",
header_fields=
{
kid: key_id
}
)
puts token
把代码粘上去
继续终端步骤
ruby secret_gen.rb
此时就生成了 client_secret
如果有关于如何与后台交互的小伙伴可以评论联系我哦!











网友评论