Authorize application, code level without hitting browser [Doorkeeper]

I found a related question with no satisfactory answer, so I'm asking here again:

I am using Doorkeeper GEM for API calls for my application. I followed the steps given in the oauth2 gem docs:

require 'oauth2'
client = OAuth2::Client.new('client_id', 'client_secret', :site => 'https://example.org')

client.auth_code.authorize_url(:redirect_uri => 'http://localhost:8080/oauth2/callback')

      

As we can see, the last execution of the line gives the URL to be used in the browser and get the authorization code after clicking " Authorize ".

But I want to do all of this at the Rails model level, so that I don't have to hit the browser for the authorization code , and it must internally receive the code that I can use later to generate tokens.

Is it possible?

+3


source to share


1 answer


It sounds like you want to use the resource owner credentials resource for OAuth2. Your best bet is to describe how to set this up with Doorkeeper and the OAuth2 gem in the Doorkeeper wiki .



+4


source







All Articles