0
GitHub統合APIと対話する必要がありますが、特に.NET 4.0からはOctokitを使用できません。.NET 4.0でPEM秘密鍵を使用してRS256でJWTトークンに署名
基本的に私はPEM
公式プライベートRSAキー(標準の.NET APIではサポートされていません)を与えられており、RS256 jwtトークンを送信してAPIとやり取りする認証トークンを取得する必要があります。
次ルビーのサンプルコードが提供された次のカールの例では
# Private key contents
private_pem = File.read(path_to_pem)
private_key = OpenSSL::PKey::RSA.new(private_pem)
# Generate the JWT
payload = {
# issued at time
iat: Time.now.to_i,
# JWT expiration time
exp: 1.minute.from_now.to_i,
# Integration's GitHub identifier
iss: 42
}
jwt = JWT.encode(payload, private_key, "RS256")
curl -i -X POST \
-H "Authorization: Bearer $JWT" \
-H "Accept: application/vnd.github.machine-man-preview+json" \
https://api.github.com/installations/:installation_id/access_tokens
そして、次の結果の例:
Status: 201 Created
{
"token": "v1.1f699f1069f60xxx",
"expires_at": "2016-07-11T22:14:10Z",
"on_behalf_of": null
}