# File lib/oauth/controllers/provider_controller.rb, line 35
      def token
        @client_application = ClientApplication.find_by_key! params[:client_id]
        if @client_application.secret != params[:client_secret]
          oauth2_error "invalid_client"
          return
        end
        # older drafts used none for client_credentials
        params[:grant_type] = 'client_credentials' if params[:grant_type] == 'none'
        logger.info "grant_type=#{params[:grant_type]}"
        if ["authorization_code", "password", "client_credentials"].include?(params[:grant_type])
          send "oauth2_token_#{params[:grant_type].underscore}"
        else
          oauth2_error "unsupported_grant_type"
        end
      end