doorkeeper
Search…
Other Configurations

Custom Access Token Generator

By default a 128 bit access token will be generated. If you require a custom token, such as JWT, specify an object that responds to .generate(options = {}) and returns a string to be used as the token.
1
Doorkeeper.configure do
2
access_token_generator "Doorkeeper::JWT"
3
end
Copied!
JWT token support is available with Doorkeeper-JWT.

Custom controllers

By default Doorkeeper's main controller Doorkeeper::ApplicationController inherits from ActionController::Base. You may want to use your own controller to inherit from, to keep Doorkeeper controllers in the same context than the rest your app:
1
Doorkeeper.configure do
2
base_controller 'ApplicationController'
3
end
Copied!
Also you could override Doorkeeper::ApplicationMetalController that is ActionController::API by default.
1
Doorkeeper.configure do
2
base_metal_controller 'ApplicationController'
3
end
Copied!

Customizing errors

If you don't want to use default Doorkeeper error responses you can raise and rescue it's exceptions. All you need is to set configuration option handle_auth_errors to :raise. In this case Doorkeeper will raise Doorkeeper::Errors::TokenForbidden, Doorkeeper::Errors::TokenExpired, Doorkeeper::Errors::TokenRevoked or other exceptions that you need to care about.

Other customizations

Last modified 1yr ago