google oauth2如何获取服务帐户的私钥

google oauth2如何获取服务帐户的私钥

问题描述:

有人可以告诉我如何从服务帐户的谷歌云控制台下载证书。我正在寻找各地。我已经下载了应用程序授权凭证client_secret.json

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有一个密钥client_x509_cert_url,它将我带到嵌入了2个证书的json文件在里面。这是证书吗?如果他们是如何在java代码中使用它。
我在这里有点迷失。

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. Are this the certificate? if they are how do I use it in java code. I am bit lost over here.

更新(2013-12-18):
Google今天早上更新了云端控制台。生成私钥的新说明如下:

Update (2013-12-18): Google updated the Cloud Console this morning. The new instructions for generating a private key are:


  1. 打开您的项目。

  2. 转到 API& Auth。

  3. 转到凭证。

  4. 点击创建新客户ID。

  5. 选择服务帐户。

  1. Open your project.
  2. Go to "APIs & Auth".
  3. Go to "Credentials".
  4. Click "Create new client ID".
  5. Select "Service Account".

过时的说明(2013-12-18之前):
以下是如何在Google Cloud Console中生成私钥:

Obsolete instructions (prior to 2013-12-18): Here is how to generate a private key in the Google Cloud Console:


  1. 打开您的项目。

  2. 转到API& Auth。

  3. 转到已注册的应用。

  4. 点击注册应用。

  5. 选择Web应用程序。

  6. 打开证书。

  7. 单击生成证书。

  8. 点击下载私钥。

  9. 点击查看公钥以关闭对话框。

  1. Open your project.
  2. Go to "APIs & Auth".
  3. Go to "Registered apps".
  4. Click "Register app".
  5. Select "Web application".
  6. Open "Certificate".
  7. Click "Generate Certificate".
  8. Click "Download Private Key".
  9. Click "View Public Key" to dismiss the dialog.

JSON中的URL会将您带到一个公共URL,在该公共URL中可以找到相应私钥的公钥 - 这不是您要查找的内容。

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.