我的应用使用Oauthed Cloud Endpoints并且在生产环境中正常工作。如何使用Oauth在devserver上测试云端点
我的问题是,在本地devserver,我的用户的用户总是被设置为[email protected],即使我已经通过正常的身份验证,访问代码,等等等等走了,有一个有效的authed用户。
我得到那个[email protected]对于oauth工作正常之前测试oauth端点是有用的,但是由于我的应用程序正在工作,我宁愿在那里看到实际的用户。
具体而言,我的终点的方法是
@ApiMethod(name = "insertEmp"), etc
public Emp insertEmp(User user, Emp emp) {
System.out.println(user.getEmail()); // (A) log "appengine" email
System.out.println(OAuthServiceFactory.getOAuthService().getCurrentUser().getEmail(); // (B) log authed email
...
在部署时,一切都很好,都(A)和(B)的登录身份验证的用户([email protected])。 (A)总是记录“[email protected]”,尽管我已经通过Oauth序列并且拥有有效的,经过身份验证的用户,并且(B)记录了my.email @ gmail.com。因此,我可以进行高保真度测试,我需要用户成为真正的身份验证用户。
因此,简单地说,我如何得到(A)和(B)是相同的?
不适用于我...使用appengine 1.9.3和电子邮件继续相同:[email protected] –
你仍然能够得到真正的电子邮件?我得到null作为用户,如果我调用OAuthServiceFactory.getOa ..()。getCurrentUser()我得到[email protected] – Patrick
同样在这里。我为端点返回的用户以及OAuthServiceFactory.getOAuthService()获取了[email protected]。getCurrentUser() – Patrick