Facebooker before_connect(facebook_session) causes http error with email
I am using the facebooker authlogic plugin. I have it working pretty well now. However, any attempt to set the email address in User.before_connect(facebook_session) is causing a A开发者_JS百科pache to throw the following error:
Premature end of script headers: person_session, referer:
(person_session is my user_session).
Here is the code for before_connect:
def before_connect(facebook_session) self.name = facebook_session.user.name self.login=facebook_session.user.first_name self.points=Person.default_points
Rails.logger.debug("*********email: "+facebook_session.user.email)
self.email=facebook_session.user.email
end
Note that the email address that is logged before the error occurs is valid.
My guess is that adding the '@' is causing it to fail. Another possibility is that it's trying to do some validation of the email address which causes the http error.
Any ideas would be appreciated.
Thanks.
Apparently you can also get the email from the facebook_session in your application. But you have to put the following in your application_controller to access the facebook_session (this was non-obvious and only discovered from another person's obscure post):
before_filter :set_facebook_session helper_method :facebook_session
精彩评论