By not putting the options that you see below, it omniauth
returns the normal information from Facebook but I need all the information (gender, first and second name, email...)
The only extra information returned is the nombre
and the id
.
This is how I call it:
auth = request.env["omniauth.auth"]
session[:omniauth] = auth
omniauth.rb
provider :facebook, 'key', 'key', {:scope => 'email', :info_fields => 'email,name,first_name,last_name,gender', :client_options => {:ssl => {:ca_file => Rails.root.join("cacert.pem").to_s}}}
Everything you ask for can be obtained through the permission game
public_profile
. The problem is that you are only indicatingemail
and that is not included in the data set provided by said parameter. (Facebook ref.)Therefore what you have to modify is the value of
:scope
and also indicatepublic_profile
.provider :facebook, 'key', 'secret', {:scope => 'email, public_profile', :client_options => {:ssl => {:ca_file => Rails.root.join("cacert.pem").to_s}}}
This should work. And remember to take the response from facebook through the console to know what you are receiving from its API.