上使用AppIdentityService的我目前使用com.google.appendinge.api.appidentity.AppIdentityService
便于认证&授权使用相同的应用程序的[即一个应用程序。相同的帐户]电子表格数据通过SpreadsheetService
API。在部署到GAE环境的生产模式下非常有效。但是,由于显而易见的原因,它在我的开发appengine环境中运行并不起作用(认证错误,并不奇怪)。配置开发服务器
我的问题是:是否有可能&“支持”一个人的本地开发服务器配置为使用所需的关键&证书信息,使AppIdentityService按预期工作?
我读的文章https://sites.google.com/site/oauthgoog/authenticate-google-app-engine-app我理解它表明,它是可能的,但我被错误地理解关键点&将不胜感激对此的任何反馈Pro & CON。
在一个完美的世界中,我希望我的测试环境尽可能地模仿生产模式。我也在考虑在我的测试环境中使用'normal'oauth2 web应用程序认证,但如果可能的话,宁愿坚持使用AppIdentityService。
我怀疑appengine-api-stubs.jar
中的com.google.appengine.api.appidentity.dev.LocalAppIdentityService
类是预期的技术,但有其他人也使用它来在开发服务器中提供AppIdentityService
验证吗?我最初的假设是将com.google.appengine.spi.FactoryProvider中的类com.google.appengine.api.appidentity.IAppIdentityServiceFactoryProvider
替换为使用我自己的工厂类,使用上面的LocalAppIdentityService类。还是我吠叫错了树?
使用适用于Java的GAE SDK 1.8.8。
我不认为使用AppIdentity有很多意义:AppIdentity的信任锚是Prod中的App Engine。在开发环境中,无论如何您都需要新的信任锚(即服务帐户)。你可能编写一个新的AppIdentityService,但为什么要麻烦? Dev中无论如何都需要一个新用户,因此需要不同的代码。 我使用生成DriveService和SpreadsheetService的工厂,使用AppIdentity(在Prod中)或服务帐户(在Dev中)。 AppIdentity和服务帐户在Drive中获得不同的权限,服务帐户只能访问测试数据。 –