Files
sure/app/controllers/oauth/authorizations_controller.rb
T
AtlasandJuan José Mata 53a87a7645 fix(mcp): assign OAuth clients read_write scope (#2884)
* fix(mcp): assign OAuth clients read_write scope

* fix(mcp): default registered OAuth scope

---------

Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
2026-08-04 23:10:39 +02:00

13 lines
395 B
Ruby

class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
before_action :default_mcp_scope, only: [ :new, :create ]
private
def default_mcp_scope
return if params[:scope].present?
application = Doorkeeper::Application.find_by(uid: params[:client_id])
params[:scope] = "read_write" if application&.scopes.to_s.split == [ "read_write" ]
end
end