New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faraday SSL Error with Google OAuth2 #36

Closed
uzomao opened this Issue Jul 2, 2015 · 8 comments

Comments

Projects
None yet
6 participants
@uzomao
Copy link

uzomao commented Jul 2, 2015

@AlexHandy1 and I are running into some significant problems with Google OAuth and after ploughing through errors for 1hr+ have now hit a Faraday SSL error which seems to want us to edit low-level SSL cert files.

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

Feels like we are off track - would appreciate some help from coaches (or someone who has successfully set-up google authentication)

@uzomao

This comment has been minimized.

Copy link
Author

uzomao commented Jul 2, 2015

We have added this to our config/initializers/omniauth.rb:

``Rails.application.config.middleware.use OmniAuth::Builder do
provider :google_oauth2, ENV['YT_CLIENT_ID'], ENV['YT_CLIENT_SECRET'], :client_options => {:ssl => {:ca_file => '/etc/pki/tls/certs/ca-bundle.crt'}, :scope => 'userinfo.profile,youtube'}, provider_ignores_state: true
end`

It began with this issue: mkdynamic/omniauth-facebook#73
Tried to resolve by adding provider_ignores_state: true to config/initializers/omniauth.rb
We also looked into: http://stackoverflow.com/questions/22386149/why-am-i-getting-csrf-detected-with-omniauth-and-google and omniauth/omniauth-oauth2#58

@tansaku

This comment has been minimized.

Copy link

tansaku commented Jul 2, 2015

@chidumaga @AlexHandy1 can you put a link to your repo (relevant branch or commit ideally) in here as well - just trying to get you to follow best practise: https://github.com/makersacademy/course/blob/master/pills/asking_questions_online.md

@uzomao

This comment has been minimized.

Copy link
Author

uzomao commented Jul 2, 2015

@danwhitston

This comment has been minimized.

Copy link

danwhitston commented Jul 2, 2015

As an update, Chidu and Alex resolved this after a couple more hours of work upon discovering that the main sticking point was running the code on localhost - uploading to Heroku resolved all problems.

@spike01

This comment has been minimized.

Copy link

spike01 commented Jul 2, 2015

Fixed on localhost:

From the Devise docs (https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview):

On OS/X, for development only, it may be easiest just to disable certificate verification because the certificates are stored in the keychain, not the file system:

require "omniauth-facebook"
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE if Rails.env.development? 
config.omniauth :facebook, "APP_ID", "APP_SECRET"

A deeper discussion of this error can be found here: omniauth/omniauth#260

@spike01

This comment has been minimized.

Copy link

spike01 commented Jul 2, 2015

You should always be able to develop on localhost, having to constantly deploy to Heroku is pretty hellish

@AlexHandy1

This comment has been minimized.

Copy link

AlexHandy1 commented Jul 2, 2015

Now working on local host too - thanks!

@pskrz

This comment has been minimized.

Copy link

pskrz commented Dec 3, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment