호스팅 된 앱에 대한 Google Federated Login (OpenID+OAuth) - 엔드 포인트 변경?
-
20-09-2019 - |
문제
Google Federated 로그인을 프리미어 앱 계정과 통합하려고하지만 문제가 있습니다.
요청을 보낼 때 : https://www.google.com/accounts/o8/ud
모든 매개 변수를 사용하여 (아래 참조), 나는 둘 다 request_token
그리고 요청한 속성 목록 Attribute Exchange
. 사용자를 응용 프로그램 데이터베이스에 저장하려면 AX (Attribute Exhange) (AX)를 통한 이메일이 필요하므로 미래에 대한 요청 토큰이 필요하기 때문에 완벽합니다. API requests to scopes
(예 : 달력, 연락처 등).
그러나 해당 URL을 사용합니다 (여기에서는 endpoint
) 사용자가 호스팅 된 앱 (Gmail, Calendar, et al), 이것은 문제입니다.
엔드 포인트를 변경합니다 https://www.google.com/a/thedomain.com/o8/ud?be=o8
모든 것을 변경합니다. 자동으로 다른 Google 앱 (Gmail 등)에 로그인했습니다. 그러나 해당 엔드 포인트를 사용하면 요청 토큰 만 얻습니다. 또는 도끼를 통한 속성. 분명히 그것은 특히 하이브리드가 아닙니다. 그것은 하나 또는 다른 하나입니다.
예제 엔드 포인트에 대한 요청 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 초기 요청에 의해 이전에 성공적으로 설정되었습니다)
나는이 하이 버드 접근 방식이 작동하여 가장 불투명 한 오류 메시지와 싸우기 위해 며칠 동안 고군분투하고 있습니다.This page is invalid
... Google에게 감사합니다) 그리고 일관된 문서가 부족합니다. 이 시점에 도달 할 수있는 모든 코드 샘플을 트롤했습니다. 도움을 주셔서 감사합니다 ...
해결책
기록, 후손 및이를 통해 올 수있는 다른 사람을 위해, 나는 (말도 안되는) 답을 문서화 할 것입니다.
궁극적으로 문제는 다음과 같습니다.
return HttpResponseRedirect(
'https://www.google.com/a/thedomain.com/o8/ud?be=o8'
+ '?'
+ urllib.urlencode(parameters)
)
당신은 그것을 발견 할 수 있습니까? 예, 문제를 일으킨 것은 물음표가 명시 적으로 포함되었습니다. 두 개의 쿼리 문자열은 한 번에 존재하지 않습니다.