使用GWT OpenID登录Gmail上下文小工具
-
14-11-2019 - |
题
在GWT应用程序中通常做的是使用OpenID登录的:
LoginInfo loginInfo = new LoginInfo();
UserService userService = UserServiceFactory.getUserService();
loginInfo.setLoginUrl(userService.createLoginURL(returnToUrl));
return loginInfo();
.
其中returntourl是您喜欢在验证后重定向的当前网址。如果returntourl是一个像
https://jtphjhg2q9h331ifsbvm5hv7717h49-a-gm-opensocial.googleussercontent.com/gadgets/ifr?ull=http%3a%2f%2fgorgactsgadget.appspot .com%2fgorgadget%2fcom.innubili.gorgacts.client.gorgadget.gadget.xml& container= gm&view= card
在OpenID注册期间,用户重新定向多个时间,如果返回托尔L不是正确的URL编码部分丢失。
当我发现这里,即使在某些情况下也必须仔细编码URL。但这一次我无法正确编码网址。
所以,我的问题:
-
您是否有任何暗示在Gmail上下文小工具中的OpenId-Return-to-URL应该是什么样子?
-
或可能有点更简单问题:有没有其他方式,我可以检索登录的gmail用户的当前电子邮件?
解决方案
You cannot use openId login from within a Gadget because your gadget is proxied by the gadget container. You have to open up a popup window to do the openId login and associate the opensocialId to your openId identity on the server. You have to persist the relation between openSocialId and the user identity on the server. From then on, the gadget knows its identity by requesting the relation of its opensocialId.
see also http://code.google.com/googleapps/marketplace/best_practices.html#gadget_sso