Google联合登录(OpenID + Oauth)用于托管应用程序 - 改变终点?

问题描述:

我在尝试将Google联合登录与首要应用帐户集成,但我遇到了一些问题。Google联合登录(OpenID + Oauth)用于托管应用程序 - 改变终点?

当我将请求发送到:所有的参数https://www.google.com/accounts/o8/ud(见下文),我回来都是由Attribute Exchange要求属性的request_token和列表。这是完美的,因为我们需要通过属性exhange(AX)的电子邮件将用户存储在我们的应用程序数据库中,并且我们需要未来API requests to scopes(即:日历,联系人等)的请求令牌。

然而,使用该URL(本文中称为endpoint)不登录的用户保持其托管应用程序(Gmail,日历,),这是一个问题。

将终端更改为https://www.google.com/a/thedomain.com/o8/ud?be=o8会改变一切。我自动登录到其他谷歌应用程序(Gmail等)。但是,使用该端点,我只能通过AX获取请求令牌的属性。显然这不是特别的混合。它是非常多的一个或另一个。

实例请求https://www.google.com/accounts/o8/ud

parameters = { 
    'openid.ns': 'http://specs.openid.net/auth/2.0', 
    'openid.claimed_id': 'http://specs.openid.net/auth/2.0/identifier_select', 
    'openid.identity': 'http://specs.openid.net/auth/2.0/identifier_select', 
    'openid.return_to':'http://our.domain.com/accounts/callback/', 
    'openid.realm': 'http://our.domain.com/', 
    'openid.assoc_handle': assoc_handle, 
    'openid.mode': 'checkid_setup', 

    'openid.ns.ext2': 'http://specs.openid.net/extensions/oauth/1.0', 
    'openid.ext2.consumer': 'our.domain.com', 
    'openid.ext2.scope': 'https://mail.google.com/mail/feed/atom', 

    'openid.ns.ax':'http://openid.net/srv/ax/1.0', 
    'openid.ax.mode':'fetch_request', 
    'openid.ax.required':'firstname,lastname,email', 
    'openid.ax.type.firstname':'http://axschema.org/namePerson/first', 
    'openid.ax.type.lastname':'http://axschema.org/namePerson/last', 
    'openid.ax.type.email':'http://axschema.org/contact/email',  
} 
return HttpResponseRedirect(end_point + '?' + urllib.urlencode(parameters)) 

(把assoc_handle先前成功利用OpenID的初始请求设置)端点

我一直在挣扎了几天试图让这个HYBIRD方式工作,战斗大多数不透明的错误信息(This page is invalid ......感谢Google),缺少一致的文档。我已经浏览了我可以达到的每个代码示例。任何帮助,将不胜感激...

为了记录,后代,和其他任何人可能会来这个,我会记录(荒谬)的答案。

最终,该问题在呼唤:

return HttpResponseRedirect(
    'https://www.google.com/a/thedomain.com/o8/ud?be=o8' 
    + '?' 
    + urllib.urlencode(parameters) 
) 

你能发现它?是的,这是明确包含导致问题的问号。两个查询字符串一次不存在。