나는 authlogic-example-app으로 게임을하고 있는데, 사용자 등록시 OpenID 제공 업체 (내 경우 Google과 Yahoo)의 이메일 주소를 가져 오지 못하고 있습니다. resp. 전자 메일 주소 대신 빈 응답을받습니다 (아래 코드의 주석을 확인하십시오).Ruby-OpenID : OpenID 제공 업체의 이메일 주소 필요
이것은 내 사용자 모델이 보이는 방식입니다 (위에서 언급 한 authlogic-example-app의 "with_openid"- 브랜치와 비슷한 모든 것). 누락 된 '이메일'외에도 openid 인증 프로세스는 예상대로 작동합니다.
class User < ActiveRecord::Base
acts_as_authentic do |c|
# not needed because I use OpenID
c.validate_login_field = false
# avoid failed validation before OpenID request
c.validate_email_field = false
# this one sets 'openid.sreg.required=email'
c.required_fields = [:email]
end
private
# overwriting the existing method in '/lib/authlogic_openid/acts_as_authentic.rb'
def map_openid_registration(registration)
# this is my problem: 'registration' is an empty hash
self.email ||= registration[:email] if respond_to?(:email) && !registration[:email].blank?
end
end
어떤 문제 해결 방법이 있습니까? authlogic을 사용하기 전에이 작업을 수행 한 사람이 있습니까? 또는 더 나은 점 : 실제 사례가 있습니까?
업데이트은 : 인증하고 가져
예 요청 : 나는 Google 계정 인증 API 문서에 example requests와 (ruby-openid-gem 및 openid-authentication-plugin 사용) Google Account Authentication API을 확인하고 authlogic에 의해 제출 된 요청을 비교 Google의 이메일 주소 :
https://www.google.com/accounts/o8/ud
?openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0
&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select
&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select
&openid.return_to=http%3A%2F%2Fwww.example.com%2Fcheckauth
&openid.realm=http%3A%2F%2Fwww.example.com%2F
&openid.assoc_handle=ABSmpf6DNMw
&openid.mode=checkid_setup
&openid.ns.ext1=http%3A%2F%2Fopenid.net%2Fsrv%2Fax%2F1.0
&openid.ext1.mode=fetch_request
&openid.ext1.type.email=http%3A%2F%2Faxschema.org%2Fcontact%2Femail
&openid.ext1.required=email
내 appliation에 의해 제출 된
요청 :
https://www.google.com/accounts/o8/ud
?openid.assoc_handle=AOQobUcdICerEyK6SXJfukaz8ygXiBqF_gKXv68OBtPXmeafBSdZ6576
&openid.ax.mode=fetch_request
&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select
&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select
&openid.mode=checkid_setup
&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0
&openid.ns.ax=http%3A%2F%2Fopenid.net%2Fsrv%2Fax%2F1.0
&openid.ns.sreg=http%3A%2F%2Fopenid.net%2Fextensions%2Fsreg%2F1.1
&openid.realm=http%3A%2F%2Flocalhost%3A3000%2F
&openid.return_to=http%3A%2F%2Flocalhost%3A3000%2Faccount%3Ffor_model%3D1%26_method%3Dpost%26open_id_complete%3D1
&openid.sreg.required=email
전체 설치를 디버깅하는 동안, 나는 openid-authentication-plugin은 적어도이, 그것은 오픈 ID 공급자로부터받은 응답 이메일을 수신하지 않는다는 것을 발견했습니다 내 사용자 모델의 registration
해시가 비어있는 이유는 ... 설명
UPDATE : 당신이 authlogic 및 오픈 ID로 주위를 연주하는 경우, latest railscast on this subject을 확인하는 것을 잊지 마세요!
이 필드가 활성화되면 오류가 발생합니다 ... : 0x2643d84> ... without these : # c.required_fields = [ "http://axschema.org/contact/email"] # sreg로 이메일 가져 오기 # c.optional_fields = [ "email"] 작동합니다. – holden
@holden : 내가 제출 한 github-issue에 대한 답변으로이 문제를 설명했습니다. – Javier
당신은 또한이 포크에 흥미가있을 것입니다. (README에 따라) 일부 SReg 대 AX 선택을 다루는 것입니다 : https://github.com/binaryfeed/open_id_authentication - 질문, 본질적으로 주제와 관련이있는 것처럼 보입니다. – lindes