Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 659
MrTheWalrus Avatar asked Jan 25 '13 19:01

MrTheWalrus


1 Answers

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.

like image 183
MrTheWalrus Avatar answered Oct 10 '22 17:10

MrTheWalrus