Reputation: 457
Currently I am asking user to fill email and password in a form for a specific email client say Gmail. I think the authentication should be done at the email client. That would be convincing.
How to redirect authentication to email clients.
So that, user types the details in gmail and gmail returns a token to my web server, so that user can retrieve her contacts in my web app.
Is there any support to do this using contacts gem? Any other gems to use?
Thanks.
Upvotes: 0
Views: 605
Reputation: 13726
I have that feature working using the omnicontacts gem
gem 'omnicontacts'
I basically followed the instructions to set it up, you need to specify (in a initializer
) the importer, and then the needed data, like
Rails.application.middleware.use OmniContacts::Builder do
importer :gmail, GMAIL_CONFIG['client_id'], GMAIL_CONFIG['client_secret']
end
and then I have something like this in routes.rb
:
match '/contacts/:importer/callback' => 'mailer_contacts#callback'
Lastly you setup your MailerContactsController
with the callback
action (for example redirecting where you need it to go).
Upvotes: 1