I'm trying to use the omniauth-reddit gem. I have gotten as far as getting the account holder to say they want to "allow" my app to grant access to their account. After I click allow, I get an error from Rails:
OAuth2::Error
invalid_grant: {"error": "invalid_grant"}
This is what my omniauth.rb file looks like:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :reddit, "XXX", "YYY", {:duration => "permanent", :scope => "identity,subscribe,vote,submit,history,read,mysubreddits"}
end
And my routes:
Rails.application.routes.draw do
root 'homes#index'
get '/auth/reddit', as: :reddit_login
get '/auth/reddit/callback', to: "sessions#create"
end
Having this too. Seems like the strategy for omniauth-reddit isn't working correctly.
EDIT: Looks like the issue comes from a newer version of the omniauth-oatuh2 gem.
If you include gem 'omniauth-oauth2', '~> 1.3.1'
in your Gemfile, it should work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.