All threads / API Authentication with an OAuth Provider Discussion

Ask A Question


You’re not receiving notifications from this thread.

API Authentication with an OAuth Provider Discussion

Awesome! Can't wait to see the next videos!
When accessing the me.json endpoint, my doorkeeper_token seems to be null.

I signed up with a new user via devise... then tried to access the endpoint.

Do i need to some fiddling with registering a new oauth app and acquiring a key then sending it along in the request w/ postman or something?



I can't access the me.json endpoint,

11:06:01 web.1     | Started GET "/api/v1/me.json" for ::1 at 2018-07-20 11:06:01 +0100

11:06:01 web.1 | Processing by Api::V1::UsersController#me as JSON
11:06:01 web.1 | Filter chain halted as :doorkeeper_authorize! rendered or redirected
11:06:01 web.1 | Completed 401 Unauthorized in 2ms (ActiveRecord: 0.0ms)


same here - did you figure it out?

same here some one find the solution?????

Same error. Chris, could you help?

Same error here. Someone solved this ?

In the screencast, I just commented out the before_action so I could show the JSON it renders. You won't be able to access the URL directly unless you make the request with your token. You can use Postman to try it out, or just uncomment the doorkeeper before_action like I did.

My solution was:

      before_action :doorkeeper_authorize!, unless: :user_signed_in?

      def current_resource_owner
        @current_user ||= if doorkeeper_token
          warden.authenticate(scope: :user)


Thanks for the workaround. Worked for me.

Ummm am I supposed to create a user account? I'm confused. Or are we simply logging in. because my respond_with returns nul.


Would anyone recommend setting up a main repo with submodules for this kind of project?


Did anyone else get this error? I get this error when I attempt to go to the /ouath/applications url

Access to admin panel is forbidden due to Doorkeeper.configure.admin_authenticator being unconfigured

I tried creating a user and making sure the user is an admin, but maybe the template doesn't fully create a full working web app with devise? It keeps saying things like "lasted signed in at & current sign in at" doesn't exist for the user schema.

Did you sort this out @geraldcarter


Hi Chris is this video a follow on from something else, there seems to be a lot of code not outlined in the video. Just want to make sure I am starting at the start

Hey Jeremy,

Like I mentioned at the beginning, we're using the Jumpstart template that I made.

I'm not gonna waste your time installing Devise and Bootstrap every episode, so I made the Rails Jumpstart template for that. 👍

Thats awesome mate, is there a video where you show how to create that? I only asked because when I went to http://localhost:3000/oauth/applications i got a blank page

That route comes from the doorkeeper gem, so if it's blank, then your installation may not be done right.

This is the episode on the Rails template:


I am not sure what i am doing wrong but i keep hitting

Started GET "/oauth/applications" for at 2018-09-13 14:37:44 +1000
Processing by Doorkeeper::ApplicationsController#index as HTML
Access to admin panel is forbidden due to Doorkeeper.configure.admin_authenticator being unconfigured.
Filter chain halted as :authenticate_admin! rendered or redirected
Completed 403 Forbidden in 2ms (ActiveRecord: 0.0ms)

Check the 3rd line there:

Access to admin panel is forbidden due to Doorkeeper.configure.admin_authenticator being unconfigured.

Uncommented and removed head :forbidden unless current_user.admin? as i do not have an admin role set up.


Anyone have any easy guides for creating a sign in with Slack? (Without Devise) bare bones...


I don't know how mutch it will break the logic
but impossible for me to follow exactly the video .
Something is not working as Chris show.
i'm talking about the me.json.jbuilder

ii have the error ⚠️

undefined local variable or method `current_resource_owner' for #<#<Class:0x00007fe41cabc360>:0x00007fe41bda5f28>
Did you mean?  current_user

to solve this ...
json.avatar_url gravatar_image_url(, size: 40)
json.avatar_url gravatar_image_url(, size: 40)

and it work ✅ but i think that the futur logic won't work
any advice to help ?


Set this up a while ago using the old railscasts tutorial. BUT how on earth do you secure the route to /oauth/applications.... On my production site I don't want people to be able set up new appplications to connect to, as this is part of my saas service

I just add a constraint around it in my routes.rb.


When I go to /oauth/applications/new, Rails gives the following error:
NoMethodError in Doorkeeper::Applications#new and in the logs it says this is the issue:

ActionView::Template::Error (undefined method `persisted?' for nil:NilClass):
12:33:56 web.1     |     1: <%= form_for application, url: doorkeeper_submit_path(application), html: {class: 'form-horizontal', role: 'form'} do |f| %>
12:33:56 web.1     |     2:   <% if application.errors.any? %>
12:33:56 web.1     |     3:     <div class="alert alert-danger" data-alert><p><%= t('doorkeeper.applications.form.error') %></p></div>
12:33:56 web.1     |     4:   <% end %>

On oauth/applications it throws a similar error`:

ActionView::Template::Error (undefined method `each' for nil:NilClass):
12:36:29 web.1     |     14:   </tr>
12:36:29 web.1     |     15:   </thead>
12:36:29 web.1     |     16:   <tbody>
12:36:29 web.1     |     17:   <% @applications.each do |application| %>
12:36:29 web.1     |     18:     <tr id="application_<%= %>">
12:36:29 web.1     |     19:       <td><%= link_to, oauth_application_path(application) %></td>
12:36:29 web.1     |     20:       <td><%= application.redirect_uri %></td>

application and @applications are nil and I do notice there is an ApplicationsController with some devise code in it after downloading the jumpstart template.

Any advice on how to make the @applications and application work for Doorkeeper would help!


I downloaded the source code and got that up and running. I will continue to follow along with the videos, not sure why mine did not work. Could be newer versions of gems and rails in the jumpstart template.



Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 41,443+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2021 GoRails, LLC. All rights reserved.