为什么禁用托管VM的OAuth?

时间:2015-01-15 13:20:43

标签: java google-app-engine oauth google-cloud-endpoints

我在托管虚拟机上使用Google AppEngine和Google Cloud Endpoints。

我的服务非常简单:

public List<DBObject> getCustomers(User user) throws OAuthRequestException {
    authService.check(user);
    DB db = databaseClient.getDb();
    List<DBObject> customers = db.getCollection(Customer.COLLECTION).find().toArray();
    return customers;
}

它应该接收经过身份验证的用户作为参数并使用我的authService进行检查,如果用户未获得授权,则会抛出OAuthRequestException。

在开发服务器上一切正常,但在生产(在托管虚拟机上)时,我收到以下错误:

HTTP ERROR: 500 
Problem accessing /_ah/spi/com.company.api.MyApi.getCustomers. 
Reason: com.google.apphosting.api.ApiProxy$FeatureNotEnabledException: This feature is disabled for Managed VMs.

并记录:

com.google.apphosting.vmruntime.VmApiProxyDelegate convertApiResponseRpcErrorToException: 
RPC failed, API=user.GetOAuthUser : FEATURE_DISABLED : This feature is disabled for Managed VMs.

有没有办法避免这个错误?为什么在托管虚拟机上禁止OAuth?

我绝对无法切换托管虚拟机,但我还需要OAuth才能正常运行。

1 个答案:

答案 0 :(得分:1)

根据Google的documentation,托管虚拟机仍处于测试版发布状态,因此您将在未来版本中获得(可能/或将会)修复“user.GetOAuthUser:FEATURE_DISABLED”错误“或管理虚拟机的完整版本。