问题
in the callback of the authentication process I do:auth_hash = request.env['omniauth.auth']
and then, I'm extracting the user id, but is it possible in the same time getting the user's name and email address?
回答1:
You need to first get the raw data from request.env["omniauth.auth"]
data = request.env["omniauth.auth"].extra.raw_info
username = data.first_name
email = data.email
回答2:
yesss
u can get it by doing
auth_hash[:info][:name] for name and auth_hash[:info][:email] for email
来源:https://stackoverflow.com/questions/13207211/omniauth-with-rails-get-facebook-users-information