相关疑难解决方法(0)

云终端在Android应用程序中验证失败

我在Google Cloud Endpoints Android应用中首次尝试在调试模式下使用身份验证时遇到问题.我设置了这样的凭据:

credential = GoogleAccountCredential.usingAudience(this,
           "server:client_id:long-string-i-got-from-api-console");
credential.setSelectedAccountName(accountName);
Run Code Online (Sandbox Code Playgroud)

然后尝试像这样使用它:

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 ...
Run Code Online (Sandbox Code Playgroud)

但尝试失败,我在logCat中收到这些消息:

03-06 23:33:20.418:W/System.err(11861):引起: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 google-cloud-endpoints

4
推荐指数
1
解决办法
3285
查看次数

标签 统计

android ×1

google-cloud-endpoints ×1