GitHub OAuth using Devise + OmniAuth

I have an application at http://github.com/rails3book/ticketee that contains the OAuth part provided by Devise. The configuration is in config/initializers/devise.rb . I have work with Twitter, but I always get this "invalid credentials" message from GitHub.

I don’t see what I am doing differently between Twitter and GitHub. As far as I know, this should just work (tm).

+2
source share
2 answers

This is actually because GitHub OAuth2 support is not related to the current OAuth2 specification project. In principle, they need a parameter called "access_token", but the latest version of oauth2 gem (0.3.0 at the time of this writing) passes this value as "oauth_token", as the latest version of the project requires.

This basically works with any provider other than GitHub, because they have not yet updated support for this alternative named parameter.

+5
source

Have you registered your app on Github? Do you provide the correct keys? I have a similar authentication here, without Devise, however the configuration (in development.rb) should be pretty much the same: http://github.com/markusproske/omniauth_pure

Edit: You need different registrations for development and production due to the callback route.

0
source

Source: https://habr.com/ru/post/1393647/


All Articles