I'm using Doorkeeper with rails-api to implement oAuth2 with password workflow:
resource_owner_from_credentials do
FacebookAuthorization.create(params[:username])
end
Right now when exception occurs it displays 500 template html response from rails. What I want to do is rescue any unexpected exception, then I want to custom the response error message base on exception that occurred in json response.
as the classes defined within the doorkeeper API will extend the Application controller, we can define the following in the Application controller
Then you can define the errors specifically in the ErrorsController
Hope this helps.