问题
I'm using OmniContacts gem to import contacts from yahoo and gmail to my app. Now the yahoo importer stop working.
I have the following actions on my controller:
def contacts_callback
@contacts = request.env['omnicontacts.contacts']
@importer = params[:importer]
if session[:draw_token]
@draw_token = session[:draw_token]
end
end
def import_failed
if session[:draw_token]
draw = Draw.find_by_token(session[:draw_token])
if draw != nil
session[:draw_token] = nil
redirect_to dashboard_draw_url(draw)
else
session[:draw_token] = nil
redirect_to root_path, alert: _('Draw not exists.')
end
else
redirect_to dashboard_show_invitation_email_friendship_url, alert: _('You have canceled the request.')
end
end
the routes:
get '/contacts/:importer/callback' => 'dashboard/invitation_email#contacts_callback'
get '/contacts/failure' => 'dashboard/invitation_email#import_failed'
But know when I try to import from yahoo I'm always enter to the import_failed action and I can't understand why.
Does anybody has an idea what is the problem.
Thanks in advance
回答1:
This is an old question, but I'll answer it anyways so you can close it
First, you need to use the latest version of OmniContacts, in older versions, it was not using https, which is required by yahoo. [source]
Second, you should look in your console log, you may see an error similar to this:
Custom port is not allowed or the host is not registered with this consumer key.
This probably means you are using a callback url similar to this (typical for RoR)
http://localhost:3000/contacts/callback
Yahoo does not allow specifying ports. Here is a discussion and workaround from a Yahoo Dev.
来源:https://stackoverflow.com/questions/23215434/omnicontacts-gem-always-fail-on-with-my-yahoo-contacts-importes