ruby-on-railsoauth-2.0rails-apidoorkeeper

Why do I get "Statement Invalid" error in DoorKeeper?


I am getting a peculiar error when using Doorkeeper in my rails app. Here is what my doorkeeper.rb file looks like:

  Doorkeeper.configure do
  # Change the ORM that doorkeeper will use (needs plugins)
  orm :active_record

  # This block will be called to check whether the resource owner is authenticated or not.
  resource_owner_authenticator do |routes|
    # Put your resource owner authentication logic here.
    # Example implementation:
    User.find_by_id(session[:user_id]) || redirect_to(routes.login_url)
  end

end

When I go to the route localhost:3000/oauth/authorize with my logged in user it throws this error:

ActiveRecord::StatementInvalid in Doorkeeper::AuthorizationsController#new
    Could not find table oauth_application
    def table_structure(table_name)
      structure = exec_query("PRAGMA table_info(#{quote_table_name(table_name)})", 'SCHEMA')
      raise(ActiveRecord::StatementInvalid, "Could not find table '#{table_name}'") if structure.empty?
      table_structure_with_collation(table_name, structure)
    end

Why might this error be occuring?


Solution

  • Silly me! I forgot to run the migration that was required when installing doorkeeper LOL