class Doorkeeper::OAuth::AuthorizationCodeRequest

def before_successful_response

def before_successful_response
  grant.transaction do
    grant.lock!
    raise Errors::InvalidGrantReuse if grant.revoked?
    if Doorkeeper.config.revoke_previous_authorization_code_token?
      revoke_previous_tokens(grant.application, resource_owner)
    end
    grant.revoke
    find_or_create_access_token(
      client,
      resource_owner,
      grant.scopes,
      custom_token_attributes_with_data,
      server,
    )
  end
  super
end