Class: Doorkeeper::TokensController
- Inherits:
-
Object
- Object
- Doorkeeper::TokensController
- Defined in:
- lib/tokens_controller.rb
Overview
TODO Is there a better way to implement this? This monkey patch is required to ensure the OAuth2 token includes which team was connected to. It gets required by BulletTrain::Api.set_configuration.
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/tokens_controller.rb', line 6 def create headers.merge!(.headers) user = if .is_a?(Doorkeeper::OAuth::ErrorResponse) nil else User.find(.token.resource_owner_id) end # Add the selected `team_id` to this response. render json: .body.merge(user&.teams&.one? ? {"team_id" => user.team_ids.first} : {}), status: .status rescue Doorkeeper::Errors::DoorkeeperError => e handle_token_exception(e) end |