Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Support recent Discord updates
Browse files Browse the repository at this point in the history
Until today, providing a bogus redirect_uri was required; today, it is not allowed.

fixes #6
  • Loading branch information
fredemmott committed Mar 27, 2019
1 parent ea99f7d commit 01ae320
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
8 changes: 3 additions & 5 deletions Sources/Windows/DiscordClient_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ std::string urlencode(const std::string& in) {
std::string out;
for (const auto c : in) {
if (
(c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')
|| (c >= '0' && c <= '9')) {
(c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')
|| c == '.') {
out += c;
continue;
}
Expand Down Expand Up @@ -71,9 +71,7 @@ DiscordClient::Credentials DiscordClient::getOAuthCredentials(
hRequest, headers, wcslen(headers), HTTP_ADDREQ_FLAG_ADD);
std::stringstream ss;
ss << "grant_type=" << urlencode(grantType) << "&" << urlencode(secretType)
<< "=" << urlencode(secret)
<< "&redirect_uri=" << urlencode("https://localhost/")
<< "&client_id=" << urlencode(mAppId)
<< "=" << urlencode(secret) << "&client_id=" << urlencode(mAppId)
<< "&client_secret=" << urlencode(mAppSecret) << "&scope=rpc";
const auto postData = ss.str();
DebugPrint("Sending to discord www api: %s", postData.c_str());
Expand Down
1 change: 0 additions & 1 deletion Sources/macOS/DiscordClient_mac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ DiscordClient::Credentials DiscordClient::getOAuthCredentials(
std::stringstream ss;
ss << "grant_type=" << urlencode(curl, grantType) << "&"
<< urlencode(curl, secretType) << "=" << urlencode(curl, secret)
<< "&redirect_uri=" << urlencode(curl, "https://localhost/")
<< "&client_id=" << urlencode(curl, mAppId)
<< "&client_secret=" << urlencode(curl, mAppSecret)
<< "&scope=" << urlencode(curl, "rpc");
Expand Down

0 comments on commit 01ae320

Please sign in to comment.