Doorkeeper (4.2.6) redirect URI does not match


 ERROR — omniauth: Authentication failure! invalid_credentials: OAuth2::Error, invalid_grant: The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.

add callback_url method in your oauth provider strategy.

module OmniAuth
  module Strategies
    class YourApplicationName < OmniAuth::Strategies::OAuth2       
         option :name, :application_name
         option :client_options, {         
              :authorize_path => "/oauth/authorize"
         }

      uid do
        raw_info["id"]
      end

      info do
        {
          :email => raw_info["email"],
          :first_name => raw_info["first_name"],
          :last_name => raw_info["last_name"]
        }
      end

      def raw_info
        @raw_info ||= access_token.get('/api/v1/me.json').parsed
      end

      def callback_url
        full_host + script_name + callback_path
      end
    end
  end
end

https://github.com/doorkeeper-gem/doorkeeper/wiki/Create-a-OmniAuth-strategy-for-your-provider

Reason of this error in doorkeeper 4.2.6

Solutions: Roll back to 1.3.1 or override the callback_url method in your strategy.

Advertisements

I am Senior Software Engineer. I love reading, writing, sharing,developing, hiking, movies, trips, mountains, brooks, hills etc.

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

StackOverFlow
Categories
Archives
%d bloggers like this: