How to Handle OAuth::Unauthorized error for Omniauth provider?

Add this piece of code in your initializer file
Rails.application.config.middleware.use OmniAuth::Builder do
  provider :twitter, twitter_consumer_key, twitter_consumer_secret
OmniAuth.config.on_failure = { |env|
This will redirect user to the failure page, instead of showing an error.


Popular posts from this blog

Inserting and Moving elements inside Ruby Array

Difference between Validations, Callbacks and Observers