[英]google oauth2 how to get private key for service account
Can somebody please tell me how do I download the certificate from google cloud console for the service account.有人可以告诉我如何从谷歌云控制台下载服务帐户的证书。 I being searching all over the place.
我正在到处寻找。 I have downloaded the applications authorization credential "client_secret.json"
我已经下载了应用程序授权凭证“client_secret.json”
The client_secret.json has a key "client_x509_cert_url" key which takes me to the json file which has 2 certificates embedded in it. client_secret.json 有一个密钥“client_x509_cert_url”,它将我带到 json 文件,其中嵌入了 2 个证书。 Are this the certificate?
这是证书吗? if they are how do I use it in java code.
如果他们是我如何在java代码中使用它。 I am bit lost over here.
我有点迷失在这里。
Update (2013-12-18): Google updated the Cloud Console this morning.更新 (2013-12-18):谷歌今天早上更新了 Cloud Console。 The new instructions for generating a private key are:
生成私钥的新指令是:
Obsolete instructions (prior to 2013-12-18): Here is how to generate a private key in the Google Cloud Console:过时说明(2013-12-18 之前):以下是在 Google Cloud Console 中生成私钥的方法:
The URL in the JSON instead takes you to a public URL where the public key for corresponding private key can be found - that's not what you are looking for. JSON 中的 URL 会将您带到一个公共 URL,在该 URL 中可以找到相应私钥的公钥 - 这不是您要查找的内容。
Open your project in gcloud在 gcloud 中打开您的项目
Go to "APIs & Services"转到“API 和服务”
Go to "Credentials".转到“凭据”。
Click "Create new client ID" or go to Service account if already created.单击“创建新客户 ID”或转到服务帐户(如果已创建)。
Select "Service Account".选择“服务帐户”。
Go to "Keys" and select "Create new key" from "ADD KEY" drop down转到“密钥”并从“添加密钥”下拉列表中选择“创建新密钥”
Select JSON or P12 as needed根据需要选择 JSON 或 P12
private_key is something like private_key 就像
"-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCxrDY54c6zXbPl\n47hElulfTBHWbI/03n/3ZwVhuaVnips11KyDImSdUH\n-----END PRIVATE KEY-----\n
should I remove "\\n" before using it?我应该在使用前删除“\\n”吗? Right now, I'm trying to sign the UTF-8 representation of the input using SHA256withRSA accordingly this document https://developers.google.com/identity/protocols/oauth2/service-account#httprest
现在,我正在尝试使用 SHA256withRSA 对输入的 UTF-8 表示形式进行签名,相应地此文档https://developers.google.com/identity/protocols/oauth2/service-account#httprest
Please correct me if there is anything wrong with the answer here JWT Computing the Signature SHA256withRSA如果这里的答案有任何问题,请纠正我JWT Computing the Signature SHA256withRSA
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.