从Android App使用凭据调用Google Endpoint时没有任何反应

时间:2022-08-22 10:09:52

I encounter problems when calling Google Endpoint from Android App with credential ONLY. My google API is protected with AUTH (clientIds, audiences) provided in API Endpoint.

从Android应用程序使用凭据调用Google Endpoint时遇到问题。我的Google API受API端点提供的AUTH(clientIds,受众群体)保护。

When calling this API in android APP, if I do not provide Google credential when building the end point :

在Android APP中调用此API时,如果我在构建终点时未提供Google凭据:

Enduserendpoint.Builder builder = new Enduserendpoint.Builder(
       AndroidHttp.newCompatibleTransport(), new GsonFactory(), null);

Then I call the API 'execute' method, it works since I receive from the server an AuthException which is right since no credential I provide. If I check the server logs, I could see the call to the API which results with this exception.

然后我调用API'execute'方法,它起作用,因为我从服务器收到一个AuthException,这是正确的,因为我没有提供凭据。如果我检查服务器日志,我可以看到对此异常产生的API调用。

Problem is now when I provide a credential :

现在问题是我提供凭证时:

Enduserendpoint.Builder builder = new Enduserendpoint.Builder(
       AndroidHttp.newCompatibleTransport(), new GsonFactory(), credential);

Then when execute() a method from API ==> NOTHING happens

然后当execute()从API ==> NOTHING发生一个方法

  • No error receive
  • 没有错误收到
  • Call to API method not made
  • 调用未进行的API方法
  • Nothing in server logs that tells me there was a call
  • 服务器日志中没有任何内容告诉我有通话

I had a look many hours and do not find what's happening ... and I dont know how I could check where the problem is since my Android app does not give me any error logs and nothing about the call in the server logs ... and when credential is null in the builder ... all works well since the server reacts with an AuthException.

我看了好几个小时,但没有发现正在发生的事情......我不知道如何检查问题所在,因为我的Android应用程序没有给我任何错误日志,也没有关于服务器日志中的调用...并且当构建器中的凭证为空时...由于服务器对AuthException作出反应,因此一切正常。

Thanks for your help

谢谢你的帮助

1 个解决方案

#1


-1  

I ran into the same problem.

我遇到了同样的问题。

Everything works fine if I use endpoint with a null credential, but if I use a non-null credential, app-engine receive nothing, even I use an api which needs no User parameter.

如果我使用具有空凭证的端点,一切正常,但如果我使用非空凭证,app-engine什么都不收,即使我使用不需要User参数的api。

Finally, I found that I cannot test directly with android sdudio. I have to sign my apk and install it manually to test an endpoint api which needs a User parameter.

最后,我发现我无法直接用android sdudio测试。我必须签署我的apk并手动安装它来测试需要User参数的端点api。

#1


-1  

I ran into the same problem.

我遇到了同样的问题。

Everything works fine if I use endpoint with a null credential, but if I use a non-null credential, app-engine receive nothing, even I use an api which needs no User parameter.

如果我使用具有空凭证的端点,一切正常,但如果我使用非空凭证,app-engine什么都不收,即使我使用不需要User参数的api。

Finally, I found that I cannot test directly with android sdudio. I have to sign my apk and install it manually to test an endpoint api which needs a User parameter.

最后,我发现我无法直接用android sdudio测试。我必须签署我的apk并手动安装它来测试需要User参数的端点api。