MrTheWalrus
MrTheWalrus

Reputation: 9700

Accessing the current client app using Doorkeeper

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?

Upvotes: 9

Views: 3703

Answers (1)

MrTheWalrus
MrTheWalrus

Reputation: 9700

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.

Upvotes: 13

Related Questions