我正在尝试将 Google 联合登录与高级应用程序帐户集成,但我遇到了一些问题。
当我将请求发送到:https://www.google.com/accounts/o8/ud带有所有参数(见下文)时,我会返回 arequest_token和请求的属性列表Attribute Exchange。这是完美的,因为我们需要通过属性交换 (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)和缺乏一致的文档。为了达到这一点,我已经搜索了所有代码示例。任何帮助,将不胜感激 ...