I am using contacts-1.2.4 for importing contacts from yahoo and gmail. The issue I am facing is that this gem is working fine on my local setup but on my production environment yahoo contacts importing is not working. It repeatedly gives authentication error. I am using Rails-3.1.1 and ruby-1.9.2 for my local and production setup.
Got it working using - https://github.com/liangzan/contacts
Now importing is working fine on production env as well.
For yahoo and gmail it is better to use https://github.com/Diego81/omnicontacts since it doesn't require people to enter their username and password.
Related
I have a RoR app that reads emails from my inbox using the gmail gem. I've deployed to Heroku and everything works fine, except connecting to gmail.
On my local machine it connects with no issues (after I allowed access for less secure apps).
Using the basic gmail login method;
Gmail.connect!('my_email#gmail.com','password')
I get the following error in production only.
Gmail::Client::AuthorizationError: Couldn't login to given Gmail account: my_email#gmail.com (Please log in via your web browser: https://support.google.com/mail/accounts/answer/78754 (Failure))
And then I'll go to https://www.google.com/accounts/DisplayUnlockCaptcha (as other answers have suggested) and it will work fine for a short time period and then suddenly stop working again.
I'm using Ruby v2.4.1, RoR v5.1.1 and the gmail gem v0.6.0 (https://github.com/gmailgem/gmail)
Any help would be great.
Are you deploying to a domain? It could be caused by the fact that:
Heroko will not give you even a range of IP addresses - they can, may and will move dynos between Amazon zones as needs require.
Your only option would be some sort of proxy node with a static IP that they talk to that securely communicates to your Heroku app - or consider if Heroku is the right fit for you here altogether.
Source: Get a finite list of IP addresses for my Heroku App?
It seems like you sign into Google and whitelist what an IP (as far as they're concerned) and then the dyno switches a bit later for whatever reason so then Google no longer has your dyno's IP in the whitelist for this app.
I have a contacts controller which has a method to connect and save the data submitted from the form to a spreadsheet in my account on google drive (app/models/contact.rb):
def update_spreadsheet
connection = GoogleDrive.login(ENV["GMAIL_USERNAME"], ENV["GMAIL_PASSWORD"])
ss = connection.spreadsheet_by_title('Learn-Rails02-Example')
if ss.nil?
ss = connection.create_spreadsheet('Learn-Rails02-Example')
end
The method calls on environment variables I set up with figaro which are saved config/environments/development.rb as follows:
GMAIL_USERNAME: tgolsby#gmail.com
GMAIL_PASSWORD: Paxxword (obviously this is a place holder for my actual password in the .yml file)
When I submit my form I get the following error:
*GoogleDrive::AuthenticationError at /contacts
Authentication failed for tgolsby: Response code 403 for post https://www.google.com/accounts/ClientLogin: Error=BadAuthentication*
It points to the following line in the contacts model:
*def update_spreadsheet*
**connection = GoogleDrive.login(ENV["GMAIL_USERNAME"], ENV["GMAIL_PASSWORD"])**
*ss = connection.spreadsheet_by_title('Learn-Rails02-Example')
if ss.nil?
ss = connection.create_spreadsheet('Learn-Rails02-Example')
end*
I have checked and rechecked my username and password and am 100% sure they are correct in the application.yml file. I have gone through the tutorial and repeated all the steps but I just cant' figure out why the app is having trouble connecting to google. I have also checked that I don't have 2 step verification set up on my google account.
You might have the same issue I had. I was accessing my google doc using the google_drive gem on a personal project I had not touched in over a year. I used to be able to access my google doc by enabling a session using session = GoogleDrive.login('rosalyntest1#gmail.com', 'password') but was now getting the same error as you.
I logged into that account using my password and saw an email from google with a subject of "sign in blocked." I followed the link https://www.google.com/settings/security/lesssecureapps to enable less secure app access for that account only and was able to enable a session locally using the same code. I would check your google account and see if you received an email or enable less secure app access and try again.
The code is good (you can check it against the learn-rails example application). It looks exactly like the code from the Learn Ruby on Rails book.
That means the problem is a result of an environment or configuration issue.
First, are you running locally, or do you have the problems after deploying to Heroku?
If running locally, here are things you can try to troubleshoot:
1) Try restarting the web server. When you change configuration files, the server has to be restarted.
2) Replace ENV["..."] in the code and use the credentials directly ("hardcode the credentials"). Be careful not to check the code into the git repo with the hardcoded credentials (and don't push to GitHub because you would expose your credentials).
3) Can you send email from the application? Comment out the code that updates the spreadsheet and you should be able to send email if your credentials are correct.
I had this problem as well, and I was able to fix it by making the ENV["GMAIL_PASSWORD"] code in my contacts model all caps just as it is in my environment. It was not working when I only had the first letter caps in the code but everything in caps in the env variable, so be sure to consider the case sensitivity of your environments.
I setup google apps and heroku to send mail. I sent the first mail from within my app and everything is great. Then, I changed the email on my google apps account (from matt#website.com to team#website.com)...made sure to change it in heroku config settings...restarted...but now it gives me this error:
Net::SMTPAuthenticationError (535-5.7.1 Please log in with your web browser and then try again. Learn more at
I tried logging in via the web browser and everything is fine. I just keep getting this same error when I try to send mail now.
This should help: http://www.rocketideas.com/2012/05/gmail-error-password-not-accepted-from-server-solved/
I've tested it and it works for me.
I am developing an app on rails 3.1 that will be using the facebook registration plugin. I am following this tutorial to do the integration. However, while i am developing my application on localhost:3000, when i create my facebook application on facebook, I need to enter a public URL for the application.
Currently i am using this awesome gem (localtunnel) to get me a public URL and it works fine. However the problem is that the URL it provides is just temporary until i restart localtunnel. Is there a way I can get a constant URL (any ugly url will do) so that I can continue development with facebook while facebook can also access my localhost:3000 through a public URL?
Localtunnel: http://progrium.com/localtunnel/
Hi' if it's still relevnt constant URL - https://ngrok.com/
works great
I didn't have an problem setting the Facebook app url to localhost:3000. Have you tried that? It works fine as long as you're testing it on a computer with the rails server running.
If that doesn't work, you might consider using a no-ip technology: www.no-ip.com (it's free for a subdomain)
you can use lvh.me:3000 as an alternate to localhost.
http://veerasundaravel.wordpress.com/2011/11/13/localhost-alternates-for-subdomain/
Install the heroku gem and upload your app there.
I installed "contacts" gem on my local machine, wrote some code to get yahoo, gmail and hotmail contacts, and it was running smoothly. I moved the code to a server for testing, my gmail and hotmail contacts were still running, but Yahoo gave me the following error:
Contacts::AuthenticationError: Username and password do not match
I am sure that email and password are correct. I tried my code on another server the behavior was the same ...
Any hints?
This is because Yahoo contacts uses Oauth, not BBauth: https://github.com/mislav/contacts/issues/4
The turingstudio version of the gem is more up to date and it seems to support Yahoo Oauth.
Install it using bundler:
gem "turing-contacts", :git => "git://github.com/turingstudio/contacts.git"