Securing the API
To protect your controllers (usual one or ActionController::API
) with OAuth, you just need to setup before_action
s specifying the actions you want to protect. For example:
You can pass any option before_action
accepts, such as if
, only
, except
, and others.
Authenticated resource owner
If you want to return data based on the current resource owner, in other words, the access token owner, you may want to define a method in your controller that returns the resource owner instance:
In this example, we're returning the credentials (me.json
) of the access token owner.
Last updated