1
votes

I am working on a Rails app where I would like to offer users to connect to theirs GMail account and then send invitation email to people, who are in the contacts on theirs GMail.

I am making the Google authentication via gem omniauth-google-oauth2 and I found this gem for getting contacts from GMail account: https://github.com/cardmagic/contacts.

The problem is, that the Contacts gem needs to know user's password, but I cannot retrieve this password through the omniauth-google-oauth2 authentication gem.

How can I tackle this? Thanks

EDIT:

The contacts gem has this usage:

Contacts::Gmail.new(login, password).contacts

But I cannot fetch the password through the omniauth-google-oauth2 gem, how to to solve it? Is there any way except asking it from users (= they needs to manually fill out it)?

1

1 Answers

0
votes

There are libraries out there that will let you do this, but the first thing you must do is register your app with Google.

https://developers.google.com/accounts/docs/RegistrationForWebAppsAuto

Then, you can use any of the supporting libraries to assist you.

Here's one for example: https://github.com/Diego81/omnicontacts

There are a number of Google services now that are requiring registration, so it doesn't hurt to go ahead and get started now.

Hope that helps!