Lui*_*ese 4 authentication gwt google-app-engine
[抱歉我的英文,我是意大利人,我会尽我所能]
我正在尝试在我的网络应用中为拥有Google帐户的用户实施登录功能.我正在关注此指南:http://code.google.com/intl/it-IT/webtoolkit/doc/latest/tutorial/appengine.html#user.
在"LoginServiceImpl.java"中
[...]
if (user != null) {
loginInfo.setLoggedIn(true);
loginInfo.setEmailAddress(user.getEmail());
loginInfo.setNickname(user.getNickname());
loginInfo.setLogoutUrl(userService.createLogoutURL(requestUri));
} else {
loginInfo.setLoggedIn(false);
loginInfo.setLoginUrl(userService.createLoginURL(requestUri));
}
[...]
Run Code Online (Sandbox Code Playgroud)
打电话给
userService.createLoginURL(requestUri);
Run Code Online (Sandbox Code Playgroud)
返回一个这样的字符串:
/_ah/login?continue=http%3A%2F%2F127.0.0.1%3A8888%2FGoogleAccounts.html%3Fgwt.codesvr%3D127.0.0.1%3A9997
Run Code Online (Sandbox Code Playgroud)
这意味着,为了允许用户登录,我必须将他重定向到这里
http://127.0.0.1:8888/_ah/login?continue=http%3A%2F%2F127.0.0.1%3A8888%2FGoogleAccounts.html%3Fgwt.codesvr%3D127.0.0.1%3A9997
Run Code Online (Sandbox Code Playgroud)
但这样做,我到达一个白色背景和蓝色框的白页:
http://img528.imageshack.us/img528/8720/formy.png
无论我放在那里的电子邮件,即使是一个形式不好的电子邮件,我都会被重定向到我的主页并且似乎成功登录,有类似的东西
if(user != null) {
System.out.println("email = "+user.getEmail());
System.out.println("nickname = "+user.getNickname());
System.out.println("userId = "+user.getUserId());
System.out.println("FederatedIdentity = "+user.getFederatedIdentity());
System.out.println("AuthDomain = "+user.getAuthDomain());
System.out.println("link to logout = "+userService.createLogoutURL("http://127.0.0.1:8888/GoogleAccounts.html?gwt.codesvr=127.0.0.1:9997"));
}
Run Code Online (Sandbox Code Playgroud)
导致
email = blablabla
nickname = blablabla
userId = 12654892720623673200
FederatedIdentity = null
AuthDomain = gmail.com
link to logout = /_ah/logout?continue=http%3A%2F%2F127.0.0.1%3A8888%2FGoogleAccounts.html%3Fgwt.codesvr%3D127.0.0.1%3A9997
Run Code Online (Sandbox Code Playgroud)
我期待某种重定向到谷歌页面,要求我授权应用程序使用我的数据......我缺少什么?难道我做错了什么?
在开发环境中,您只需看到一个" 蓝盒子(如您所说) ",您可以在其中输入任何电子邮件ID进行登录....
但是,当您在Google App Engine Server中部署应用程序时,用户将被重定向到实际的Google登录页面.
部署您的应用并尝试...
| 归档时间: |
|
| 查看次数: |
1718 次 |
| 最近记录: |