title: Undefined method `resource_owner_id' for nil:NilClass Doorkeeper
body: <p>I'm in the process of setting up <a href="https://github.com/doorkeeper-gem/doorkeeper" rel="nofollow">Doorkeeper</a> and <a href="https://github.com/intridea/oauth2" rel="nofollow">OAuth2</a> for one of my Rails Applications. My goal is to allow api access to a user depending on their access_token, so that only a user can see their 'user_show' json. So far I have my development and production applications set up and authorized on the 'oauth2/applications' route.</p>
  
  <p>My '/config/initializers/doorkeeper.rb'</p>
  
  <pre><code>Doorkeeper.configure do
    # Change the ORM that doorkeeper will use.
    # Currently supported options are :active_record, :mongoid2, :mongoid3,
    # :mongoid4, :mongo_mapper
    orm :active_record
  
    # This block will be called to check whether the resource owner is authenticated or not.
    resource_owner_authenticator do
    # Put your resource owner authentication logic here.
    # Example implementation:
      User.find_by_id(session[:current_user_id]) || redirect_to('/')
    end
  end
  </code></pre>
  
  <p>and my '/api/v1/user/controller.rb' looks as such:</p>
  
  <pre><code>class Api::V1::UserController &lt; Api::ApiController
    include ActionController::MimeResponds
    before_action :doorkeeper_authorize!
    def index
      user = User.find(doorkeeper_token.resource_owner_id)
      respond_with User.all
    end
    def show
      user = User.find(doorkeeper_token.resource_owner_id)
      respond_with user
    end
  end
  </code></pre>
  
  <p>I have tried to gain access to the OAuth Applications table to see what is being created but I cannot access it in the rails console.</p>
  
  <p>Thanks in advance for the insight!</p>