且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无需 Google 帐户登录即可向 Cloud Endpoints 验证您的客户端

更新时间:2021-07-30 22:52:05

我已经使用自定义标题授权"实现了端点身份验证,并且它工作得很好.在我的情况下,此令牌是在登录后设置的,但应该与您的应用程序完全相同.检查您的测试,因为值应该在那里.检索该标头的方法确实是:

I have implemented Endpoint Auth using a custom header "Authorization" and it works just fine. In my case this token is set after login but should work all the same with your app. Check your tests because the value should be there. The way to retrieve that header is indeed:

String Auth = req.getHeader("Authorization");

您可以更进一步,定义您自己的 Authenticator 并将其应用于您的安全 API 调用.

You could take it a step further and define your own implementations of an Authenticator and apply it to your secure API calls.