[英]Which part of the private key for service accounts in Google Cloud Platform do I actually use?
I am trying to verify I have the private_key
correct as described in this SO question .我正在尝试验证我的
private_key
是否正确, 如此 SO question中所述。
Docs about service account private keys are here. 有关服务帐户私钥的文档在这里。
{
"type": "service_account",
"project_id": "[PROJECT-ID]",
"private_key_id": "[KEY-ID]",
"private_key": "-----BEGIN PRIVATE KEY-----\n[PRIVATE-KEY]\n-----END PRIVATE KEY-----\n",
"client_email": "[SERVICE-ACCOUNT-EMAIL]",
"client_id": "[CLIENT-ID]",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/[SERVICE-ACCOUNT-EMAIL]"
}
When using private_key
, do I just get the part in between the使用
private_key
时,我是否只是在
-----BEGIN PRIVATE KEY-----\n
string and the字符串和
\n-----END PRIVATE KEY-----\n
In other words, the [PRIVATE-KEY]
shown in the example?换句话说,示例中显示的
[PRIVATE-KEY]
?
Or do I get the entire string including the two "bookend" strings shown above?还是我得到整个字符串,包括上面显示的两个“书挡”字符串?
Also, within the [PRIVATE-KEY]
string, there are several occurrences of the \n
substring.此外,在
[PRIVATE-KEY]
字符串中,多次出现\n
substring。 Do I remove them or leave them in?我是删除它们还是留下它们?
This question is also related to another question , so look out for similar symptoms when debugging.这个问题也和另一个问题有关,所以调试的时候要注意类似的症状。
This issue with Firebase authentication was caused by a malfunctioning JSON reading. Firebase 身份验证的此问题是由 JSON 读取故障引起的。
It's important to note that the private keys are meant to be used with the "useless" information, since the method to decode the private key is expecting those strings to be there.重要的是要注意,私钥是用来与“无用”信息一起使用的,因为解码私钥的方法期望这些字符串存在。
The problem was reading the JSON file correctly.问题是正确读取 JSON 文件。
Thanks to @Tanaike and @Tedinoz for the troubleshooting steps.感谢@Tanaike和@Tedinoz的故障排除步骤。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.