使用API密钥限制时Android SafetyNet API失败 [英] Android SafetyNet API fails when using API key restriction
问题描述
在对API密钥设置限制时,证明API将停止工作:
OnFailureListener
被 CANCELLED
(16)状态代码
When setting restriction to an API key the Attestation API stops working:
OnFailureListener
gets fired with the CANCELLED
(16) status code
限制是android软件包名称和证书签名(SHA-1)
The restrictions are the android package name and the certificate signature(SHA-1)
SafetyNet Attestation API是否支持受限制的API密钥?
Does the SafetyNet Attestation API support restricted API keys ?
注意:相同的API密钥,但有附加限制,可以与Google Maps API一起使用
Note: the same API key with the additional restriction works fine with Google Maps API
更新: 在运行Google Play服务v13.0及更高版本的设备上,SafetyNet Attestation API还支持受应用程序限制的API密钥. https://developer.android.com/training/safetynet/attestation
UPDATE: On devices running Google Play Services v13.0 and above, the SafetyNet Attestation API also supports app-restricted API keys. https://developer.android.com/training/safetynet/attestation
推荐答案
我已经联系了我的一个Google朋友,他联系了他们的团队.目前不支持此功能-无法通过SHA1指纹限制此API.在内部路线图上可以解决此问题,但目前无法正常工作.
I've contacted a friend of mine at Google, and he reached out to their team. This is currently not supported - there's no way to get this API restricted with the SHA1 fingerprint. It's on their internal roadmap to accommodate this, but for now it won't work.
如果您转到他们的报价请求页您会看到他们明确说不要使用任何形式的API密钥限制.
If you go to their quota request page you can see that they specifically say not to use any form of API key restrictions.
这篇关于使用API密钥限制时Android SafetyNet API失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!