准备3件东西:要上传的.csr(一个sn对应一个),凭证文件cred.json,COMPANY_ID
之前测试的
选项 1和选项 2: device_info_uploader.py 找不到。选项 3:无响应(Windwos下)
https://blog.csdn.net/chenhao0568/article/details/139346823?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522171988357416800182136039%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=171988357416800182136039&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2blogfirst_rank_ecpm_v1~rank_v31_ecpm-1-139346823-null-null.nonecase&utm_term=RKP&spm=1018.2226.3001.4450
使用下面的命令CURL就行
curl -s -X POST -H "Content-Type: application/json" -H "$(oauth2l header --json cred.json androidPartner)" -H "X-GFE-SSL: yes" -d '{company_id:COMPANY_ID, device_payloads: [{certificate_payloads:[{certificate_signing_request: "yfhJMeWfIKGaFTVj2ikmR03ftBxiPeIzzoAR0RYQSBYQJMQFBILMOb8mA9GQisgb3K9TRx4moYS3p1ZbymXcyP31GrG6UbzVXgxPcxxxxxxxxxxxxxxxxxxxxxxxxx"}]}]}' https://androidpartner.googleapis.com/v1/devices:batchUpload
替换以下值:
将 cred.json 替换为您的凭证文件路径。
将 COMPANY_ID 替换为您的 Android 合作伙伴管理公司 ID。
将 CERTIFICATE_SIGNING_REQUEST 替换为提取工具生成的 CBOR 编码证书请求。即.csr文件中的csr值。
验证是否上传成功
返回requestId 即上传成功。
{ "requestId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }
运行命令
要在linux下运行
下载oauth2l
https://github.com/google/oauth2l?tab=readme-ov-file
加入到环境变量
export PATH=$PATH:/home/aiwu/Desktop/rkp
我遇到了坑
oauth2l: command not found
{
“error”: {
“code”: 401,
“message”: “Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.”,
“status”: “UNAUTHENTICATED”,
“details”: [
{
“@type”: “type.googleapis.com/google.rpc.ErrorInfo”,
“reason”: “CREDENTIALS_MISSING”,
“domain”: “googleapis.com”,
“metadata”: {
“method”: “google.android.partner.deviceinfo.v1.AndroidPartnerDeviceInfoService.BatchUploadDeviceInfo”,
“service”: “androidpartner.googleapis.com”
}
}
]
}
}
下载oauth2l
https://github.com/google/oauth2l?tab=readme-ov-file
加入到环境变量
export PATH=$PATH:/home/aiwu/Desktop/rkp
再试
{
“error”: {
“code”: 400,
“message”: “Invalid value at ‘device_payloads[0].certificate_payloads[0].certificate_signing_request’ (TYPE_BYTES), Base64 decoding failed for “31AE303457D1007-20240701.json””,
“status”: “INVALID_ARGUMENT”,
“details”: [
{
“@type”: “type.googleapis.com/google.rpc.BadRequest”,
“fieldViolations”: [
{
“field”: “device_payloads[0].certificate_payloads[0].certificate_signing_request”,
“description”: “Invalid value at ‘device_payloads[0].certificate_payloads[0].certificate_signing_request’ (TYPE_BYTES), Base64 decoding failed for “31AE303457D1007-20240701.json””
}
]
}
]
}
}
把csr.json改为里面的base64即可。如上面图。
就返回了requestId。成功。