使用 Google 接近度 API 获取 401 和 403
Getting 401 and 403 with Google Proximity API
我已经为来自 google 的信标 API 设置了一个项目,但我尝试的每个请求都不断收到 401(使用 public 密钥)或 403示例应用 enter link description here
回复说:
{
"error":{
"code": 403,
"message": "Project has not enabled the API. Please use Google Developers Console to activate the API for your project.",
"status": "PERMISSION_DENIED",
"details":[
{
"@type": "type.googleapis.com/google.rpc.Help",
"links":[
{
"description": "Google developer console API activation",
"url": "https://console.developers.google.com/project/608941808256/apiui/api"
}
]
}
]
}
}
但我已经启用了 API。
您必须为您的应用程序创建一个 API-Key 和一个 OAuthClient-ID getting-started 和 link。创建这些后,您必须将它们限制为仅 Android 并为此 expamle 应用程序插入包名称 com.google.sample.beaconservice
。此外,您需要插入 sha1 密钥。您可以使用命令生成的调试密钥:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v
一个 OAuthClient-Id 就足够了这个示例应用程序。由于它不使用 getforobserved
方法,因此需要 manifest.xml
中的 API-Key
我已经为来自 google 的信标 API 设置了一个项目,但我尝试的每个请求都不断收到 401(使用 public 密钥)或 403示例应用 enter link description here
回复说:
{ "error":{ "code": 403, "message": "Project has not enabled the API. Please use Google Developers Console to activate the API for your project.", "status": "PERMISSION_DENIED", "details":[ { "@type": "type.googleapis.com/google.rpc.Help", "links":[ { "description": "Google developer console API activation", "url": "https://console.developers.google.com/project/608941808256/apiui/api" } ] } ] } }
但我已经启用了 API。
您必须为您的应用程序创建一个 API-Key 和一个 OAuthClient-ID getting-started 和 link。创建这些后,您必须将它们限制为仅 Android 并为此 expamle 应用程序插入包名称 com.google.sample.beaconservice
。此外,您需要插入 sha1 密钥。您可以使用命令生成的调试密钥:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v
一个 OAuthClient-Id 就足够了这个示例应用程序。由于它不使用 getforobserved
方法,因此需要 manifest.xml