- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我第一次尝试在 Google Cloud Endpoints Android 应用程序的 Debug模式下使用身份验证时遇到了问题。我这样设置凭据:
credential = GoogleAccountCredential.usingAudience(this,
"server:client_id:long-string-i-got-from-api-console");
credential.setSelectedAccountName(accountName);
然后尝试像这样使用它:
final String LOCAL_APP_ENGINE_SERVER_URL = "http://xxx.xxx.x.xxx:8888";
Testdbendpoint.Builder endpointBuilder = new Testdbendpoint.Builder(
AndroidHttp.newCompatibleTransport(),
new GsonFactory(),
credential);
endpointBuilder.setRootUrl(LOCAL_APP_ENGINE_SERVER_URL + "/_ah/api/");
Testdbendpoint endpoint = endpointBuilder.build();
try {
TestDB testDB = new TestDB().setId(10101L);
TestDB result = endpoint.insertTestDB(testDB).execute(); //-- fails here!!!!
} catch ...
但尝试失败,我在 logCat 中收到这些消息:
03-06 23:33:20.418: W/System.err(11861): Caused by: com.google.android.gms.auth.GoogleAuthException: Unknown 03-06 23:33:20.418: W/System.err(11861): at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source) 03-06 23:33:20.423: W/System.err(11861): at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source) 03-06 23:33:20.428: W/System.err(11861): at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.getToken(GoogleAccountCredential.java:192)
最佳答案
也许您的 Android 客户端 ID 的证书指纹 (SHA1) 有误?仅当您手动签署 .apk 时,使用生产 key 指纹的身份验证才有效。
在您的 API Console 中使用您的 debug.keystore 指纹为已安装的应用程序 (Android) 注册一个客户端 ID。 .要获取指纹使用:
C:\>keytool -list -alias androiddebugkey -keystore C:\.android\debug.keystore -storepass android -keypass android
您还需要一个 Web-Client-Id 并在您的 Android 应用程序中将其设置为 Audience:
credential = GoogleAccountCredential.usingAudience(this,"server:client_id:" + WEB_CLIENT_ID);
AppEngine 端点配置应如下所示:
@Api(
name = "testEndpoint",
version = "v1",
clientIds = {ClientIds.WEB_ID, ClientIds.ANDROID_PRODUCTION_ID, ClientIds.ANDROID_DEBUG_ID},
audiences = {ClientIds.WEB_ID}
)
关于android - Android 应用程序中的云端点身份验证失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15263228/
是否可以进行 Puppet 设置,在其中使用 JClouds 在云上实例化新虚拟机,然后通过 Puppet 定义和实现其配置(软件堆栈)? 或者 Puppet 的本质是否存在某些固有的因素阻碍其在 A
作者:京东零售 郑炳懿 前言: 当今世界,云计算技术在快速发展,不断为我们带来新的应用场景和解决方案。作为一名前端开发者,了解云技术并掌握如何在前端中应用它们是必不可少的。
我在我们的 iOS 通用应用程序中使用核心数据,并希望用户能够将其数据备份到我们的服务器。因此他们可以使用另一台设备登录并将该数据拉取到该设备。有人对此有什么建议吗?我想在服务器上分析数据,以便与我们
我在 Xcode 的验证过程中收到此错误,这让我抓狂。我花了几个小时试图修复它,但找不到解决方案。 我们拥有正确的分发证书、供应配置文件以及我能想到的与此相关的一切。我已经撤销并重建了我所有的项目,但
今天我对一个项目有了一个非常好的想法,不幸的是存在信息/经验障碍。 我基本上想要的是在云中运行游戏并将图像流式传输给用户。 我知道 ec2 可以选择使用 GPU,但它可能有错误的定价模型来满足我的需求
我是 Cloud Firestore 的新手(我们不都是这样吗?)并且我已经使用 Node.js 中的管理 SDK 向我的数据库添加了一些数据。它显示在控制台上,但在文档下显示“此文档不存在,它不会出
我有一个托管在 s3 存储桶上的静态 html 网站。我已经使用 let's encrypt 生成了一个免费的 ssl 证书,并将其导入到 ACM 中。 certbot --manual --serv
我一直在阅读 Cloudfront 文档,我想确保我的计划是合理的。我有一个后端 API,结构为 EC2 HTTP 服务器,内容经常更新(每秒几次更改)。这是我的理解: 我不应该将此 HTTP 服务器
我是一名优秀的程序员,十分优秀!