Websites/app/logical/discord_link.rb
2024-05-02 22:04:43 -05:00

11 lines
365 B
Ruby

# frozen_string_literal: true
module DiscordLink
module_function
def for(client_id:, redirect_uri:, scope:, response_type: "code")
params = %W[client_id=#{client_id} redirect_uri=#{CGI.escape(redirect_uri)} response_type=#{response_type} scope=#{scope.join('%20')} prompt=none]
"https://discord.com/api/oauth2/authorize?#{params.join('&')}"
end
end