Domanda

I'm using Doorkeeper to manage client applications on a Rails-based API I'm building. I have a controller action in which I'd like to check some information about the client app that submitted the request which the action is handling.

Does Doorkeeper provide a helper or other easy way to access (in a controller) the Doorkeeper::Application that made the request being processed? I'm envisioning an analogue to Devise's 'current_user' method.

If no such helper exists, how can I get this information?

È stato utile?

Soluzione

And now I've figured it out.

Doorkeeper provides doorkeeper_token, which can be accessed in the controller. This is a Doorkeeper::AccessToken object, which references the app the token belongs to (as doorkeeper_token.application). This is referenced (in the example code) here.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top