I have some problem with Omnicontacts gem in RoR. It always return empty array when I import friends from Gmail.
My config/omnicontacts.rb
:
require 'omnicontacts'
Rails.application.middleware.use OmniContacts::Builder do
importer :gmail, "775603091912-87u7d1bqgjrbsau8mtonb1pgp8nao386.apps.googleusercontent.com",
"j3ymIJ0l3kEkGycqUzqkt-dJ"
end
Code for OmniContactsController
:
class InvitesController < ApplicationController
def contact_callback
@contacts = request.env['omnicontacts.contacts']
@user = request.env['omnicontacts.user']
puts "List of contacts of #{user[:name]} obtained from #params[:importer]}:"
@contacts.each do|contact|
puts "Contact found: name => #{contact[:name]}, email => #{contact[:email]}"
end
end
def index
@contacts = request.env['omnicontacts.contacts']
respond_to do |format|
format.html
end
end
end
routes.rb
Rails.application.routes.draw do
get "/invites/:provider/contact_callback" => "invites#index"
get "/contacts/failure" => "invites#failure"
end
Help me please! Thanks!
I believe that:
Should actually be
Looking at the docs I don't see a need for the
:redirect_path
when dealing with facebook. Also it is not a good idea to publish your client_id and client_secret on public forums.