Discord Oauth2 receiving 'invalid client' errorhow to get access and refresh tokens with OAuth2?Discord OAuth Code UsageError: invalid_request Missing required parameter: client_id in golangHow can I create a discord server instant invite like using the discord API?OAuth2 authentication Redirect_uriSetting up a Discord oauth2 login on my website (with PHP?)How do I use access token from discord oauth2 login to get user informationDiscord asks to re-authorize already authorized app
How do English-speaking kids loudly request something?
Is every sentence we write or utter either true or false?
How do I write a vertically-stacked definition of a sequence?
Short story: Interstellar inspector senses "off" nature of planet hiding aggressive culture
Template default argument loses its reference type
What quests do you need to stop at before you make an enemy of a faction for each faction?
If every star in the universe except the Sun were destroyed, would we die?
k times Fold with 3 changing extra variables
At what point does a land become controlled?
Why did Tony's Arc Reactor do this?
Why did Boris Johnson call for new elections?
What is the extent of the commands a Cambion can issue through Fiendish Charm?
Friend is very nit picky about side comments I don't intend to be taken too seriously
Why are UK MPs allowed to abstain (but it counts as a no)?
Male viewpoint in an erotic novel
Should I tip on the Amtrak train?
Where on Earth is it easiest to survive in the wilderness?
Entering the US with dual citizenship but US passport is long expired?
Do aarakocra have arms as well as wings?
Let A,B,C be sets. If A△B=A△C, does this imply that B=C?
Round away from zero
Supervisor wants me to support a diploma-thesis SW tool after I graduated
Why does 8 bit truecolor use only 2 bits for blue?
Contractor cut joist hangers to make them fit
Discord Oauth2 receiving 'invalid client' error
how to get access and refresh tokens with OAuth2?Discord OAuth Code UsageError: invalid_request Missing required parameter: client_id in golangHow can I create a discord server instant invite like using the discord API?OAuth2 authentication Redirect_uriSetting up a Discord oauth2 login on my website (with PHP?)How do I use access token from discord oauth2 login to get user informationDiscord asks to re-authorize already authorized app
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I had Discord Oauth2 implemented so that my users could log into my website by authenticating through Discord. For months, everything worked great and now all of the sudden it stopped working.
Per Discord's oauth2 instructions,https://discordapp.com/developers/docs/topics/oauth2#shared-resources, I am able to successfully acquire the access code that is meant to be traded for the access token. However, when I try to receive the access token I receive an 'invalid_client' error.
First, I am hitting this endpoint:
https://discordapp.com/api/oauth2/authorize?client_id=$process.env.CLIENT_ID&redirect_uri=http%3A%2F%2Flocalhost%3A5000%2Flogin%2Fdiscord%2Fcallback&response_type=code&scope=identify%20email%20gdm.join
which successfully returns the following:
http://localhost:5000/login/discord/callback?code=some_access_code
The access code is then sent back to discord to obtain the access token. Here is the code that is failing:
export function getDiscordAccessToken(accessCode, call)
const redirect = call === 'login' ? process.env.DISCORD_LOGIN_REDIRECT : process.env.DISCORD_CONNECT_REDIRECT
return new Promise((resolve, reject) =>
axios
.post(
`https://discordapp.com/api/oauth2/token?client_id=$process.env.DISCORD_CLIENTID&client_secret=$process.env.DISCORD_SECRET&grant_type=authorization_code&code=$accessCode&redirect_uri=$redirect&scope=identify%20email%20gdm.join`
)
.then(res =>
resolve(res.data)
)
.catch(err =>
// log error to db
console.log("Here is your error: ", err.response)
reject(err.response)
)
)
This code was working for months with no problems. Then, all of the sudden it stopped working. I even checked the Discord change logs which can be found here, https://discordapp.com/developers/docs/change-log, but I found no reference to authentication changes.
Any help you can provide is greatly appreciated!
oauth-2.0 discord
add a comment |
I had Discord Oauth2 implemented so that my users could log into my website by authenticating through Discord. For months, everything worked great and now all of the sudden it stopped working.
Per Discord's oauth2 instructions,https://discordapp.com/developers/docs/topics/oauth2#shared-resources, I am able to successfully acquire the access code that is meant to be traded for the access token. However, when I try to receive the access token I receive an 'invalid_client' error.
First, I am hitting this endpoint:
https://discordapp.com/api/oauth2/authorize?client_id=$process.env.CLIENT_ID&redirect_uri=http%3A%2F%2Flocalhost%3A5000%2Flogin%2Fdiscord%2Fcallback&response_type=code&scope=identify%20email%20gdm.join
which successfully returns the following:
http://localhost:5000/login/discord/callback?code=some_access_code
The access code is then sent back to discord to obtain the access token. Here is the code that is failing:
export function getDiscordAccessToken(accessCode, call)
const redirect = call === 'login' ? process.env.DISCORD_LOGIN_REDIRECT : process.env.DISCORD_CONNECT_REDIRECT
return new Promise((resolve, reject) =>
axios
.post(
`https://discordapp.com/api/oauth2/token?client_id=$process.env.DISCORD_CLIENTID&client_secret=$process.env.DISCORD_SECRET&grant_type=authorization_code&code=$accessCode&redirect_uri=$redirect&scope=identify%20email%20gdm.join`
)
.then(res =>
resolve(res.data)
)
.catch(err =>
// log error to db
console.log("Here is your error: ", err.response)
reject(err.response)
)
)
This code was working for months with no problems. Then, all of the sudden it stopped working. I even checked the Discord change logs which can be found here, https://discordapp.com/developers/docs/change-log, but I found no reference to authentication changes.
Any help you can provide is greatly appreciated!
oauth-2.0 discord
add a comment |
I had Discord Oauth2 implemented so that my users could log into my website by authenticating through Discord. For months, everything worked great and now all of the sudden it stopped working.
Per Discord's oauth2 instructions,https://discordapp.com/developers/docs/topics/oauth2#shared-resources, I am able to successfully acquire the access code that is meant to be traded for the access token. However, when I try to receive the access token I receive an 'invalid_client' error.
First, I am hitting this endpoint:
https://discordapp.com/api/oauth2/authorize?client_id=$process.env.CLIENT_ID&redirect_uri=http%3A%2F%2Flocalhost%3A5000%2Flogin%2Fdiscord%2Fcallback&response_type=code&scope=identify%20email%20gdm.join
which successfully returns the following:
http://localhost:5000/login/discord/callback?code=some_access_code
The access code is then sent back to discord to obtain the access token. Here is the code that is failing:
export function getDiscordAccessToken(accessCode, call)
const redirect = call === 'login' ? process.env.DISCORD_LOGIN_REDIRECT : process.env.DISCORD_CONNECT_REDIRECT
return new Promise((resolve, reject) =>
axios
.post(
`https://discordapp.com/api/oauth2/token?client_id=$process.env.DISCORD_CLIENTID&client_secret=$process.env.DISCORD_SECRET&grant_type=authorization_code&code=$accessCode&redirect_uri=$redirect&scope=identify%20email%20gdm.join`
)
.then(res =>
resolve(res.data)
)
.catch(err =>
// log error to db
console.log("Here is your error: ", err.response)
reject(err.response)
)
)
This code was working for months with no problems. Then, all of the sudden it stopped working. I even checked the Discord change logs which can be found here, https://discordapp.com/developers/docs/change-log, but I found no reference to authentication changes.
Any help you can provide is greatly appreciated!
oauth-2.0 discord
I had Discord Oauth2 implemented so that my users could log into my website by authenticating through Discord. For months, everything worked great and now all of the sudden it stopped working.
Per Discord's oauth2 instructions,https://discordapp.com/developers/docs/topics/oauth2#shared-resources, I am able to successfully acquire the access code that is meant to be traded for the access token. However, when I try to receive the access token I receive an 'invalid_client' error.
First, I am hitting this endpoint:
https://discordapp.com/api/oauth2/authorize?client_id=$process.env.CLIENT_ID&redirect_uri=http%3A%2F%2Flocalhost%3A5000%2Flogin%2Fdiscord%2Fcallback&response_type=code&scope=identify%20email%20gdm.join
which successfully returns the following:
http://localhost:5000/login/discord/callback?code=some_access_code
The access code is then sent back to discord to obtain the access token. Here is the code that is failing:
export function getDiscordAccessToken(accessCode, call)
const redirect = call === 'login' ? process.env.DISCORD_LOGIN_REDIRECT : process.env.DISCORD_CONNECT_REDIRECT
return new Promise((resolve, reject) =>
axios
.post(
`https://discordapp.com/api/oauth2/token?client_id=$process.env.DISCORD_CLIENTID&client_secret=$process.env.DISCORD_SECRET&grant_type=authorization_code&code=$accessCode&redirect_uri=$redirect&scope=identify%20email%20gdm.join`
)
.then(res =>
resolve(res.data)
)
.catch(err =>
// log error to db
console.log("Here is your error: ", err.response)
reject(err.response)
)
)
This code was working for months with no problems. Then, all of the sudden it stopped working. I even checked the Discord change logs which can be found here, https://discordapp.com/developers/docs/change-log, but I found no reference to authentication changes.
Any help you can provide is greatly appreciated!
oauth-2.0 discord
oauth-2.0 discord
edited Mar 28 at 6:46
Kyle Pendergast
asked Mar 28 at 6:02
Kyle PendergastKyle Pendergast
506 bronze badges
506 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The query parameters should be in the BODY of the POST request, not the URL for the oauth/token
url.
Discord recently pushed a update to the oAuth2 which makes it confine more with the standard. This means they no longer support parameters in the URL for POST, but instead require them to be in the body and form encoded (basically the same, but in the body and without the leading ?
).
So you basically need (not tested):
axios
.post(
"https://discordapp.com/api/oauth2/token",
"client_id=$process.env.DISCORD_CLIENTID&client_secret=$process.env.DISCORD_SECRET&grant_type=client_credentials&code=$accessCode&redirect_uri=$redirect&scope=identify%20email%20gdm.join"
)
1
That worked! I figured Discord had changed something...you just saved me plenty of wasted hours. FYI, the only thing I did differently was add a config object with the header set to application/x-www-form-urlencoded
– Kyle Pendergast
Mar 28 at 6:49
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55391068%2fdiscord-oauth2-receiving-invalid-client-error%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The query parameters should be in the BODY of the POST request, not the URL for the oauth/token
url.
Discord recently pushed a update to the oAuth2 which makes it confine more with the standard. This means they no longer support parameters in the URL for POST, but instead require them to be in the body and form encoded (basically the same, but in the body and without the leading ?
).
So you basically need (not tested):
axios
.post(
"https://discordapp.com/api/oauth2/token",
"client_id=$process.env.DISCORD_CLIENTID&client_secret=$process.env.DISCORD_SECRET&grant_type=client_credentials&code=$accessCode&redirect_uri=$redirect&scope=identify%20email%20gdm.join"
)
1
That worked! I figured Discord had changed something...you just saved me plenty of wasted hours. FYI, the only thing I did differently was add a config object with the header set to application/x-www-form-urlencoded
– Kyle Pendergast
Mar 28 at 6:49
add a comment |
The query parameters should be in the BODY of the POST request, not the URL for the oauth/token
url.
Discord recently pushed a update to the oAuth2 which makes it confine more with the standard. This means they no longer support parameters in the URL for POST, but instead require them to be in the body and form encoded (basically the same, but in the body and without the leading ?
).
So you basically need (not tested):
axios
.post(
"https://discordapp.com/api/oauth2/token",
"client_id=$process.env.DISCORD_CLIENTID&client_secret=$process.env.DISCORD_SECRET&grant_type=client_credentials&code=$accessCode&redirect_uri=$redirect&scope=identify%20email%20gdm.join"
)
1
That worked! I figured Discord had changed something...you just saved me plenty of wasted hours. FYI, the only thing I did differently was add a config object with the header set to application/x-www-form-urlencoded
– Kyle Pendergast
Mar 28 at 6:49
add a comment |
The query parameters should be in the BODY of the POST request, not the URL for the oauth/token
url.
Discord recently pushed a update to the oAuth2 which makes it confine more with the standard. This means they no longer support parameters in the URL for POST, but instead require them to be in the body and form encoded (basically the same, but in the body and without the leading ?
).
So you basically need (not tested):
axios
.post(
"https://discordapp.com/api/oauth2/token",
"client_id=$process.env.DISCORD_CLIENTID&client_secret=$process.env.DISCORD_SECRET&grant_type=client_credentials&code=$accessCode&redirect_uri=$redirect&scope=identify%20email%20gdm.join"
)
The query parameters should be in the BODY of the POST request, not the URL for the oauth/token
url.
Discord recently pushed a update to the oAuth2 which makes it confine more with the standard. This means they no longer support parameters in the URL for POST, but instead require them to be in the body and form encoded (basically the same, but in the body and without the leading ?
).
So you basically need (not tested):
axios
.post(
"https://discordapp.com/api/oauth2/token",
"client_id=$process.env.DISCORD_CLIENTID&client_secret=$process.env.DISCORD_SECRET&grant_type=client_credentials&code=$accessCode&redirect_uri=$redirect&scope=identify%20email%20gdm.join"
)
answered Mar 28 at 6:38
LacheeLachee
463 bronze badges
463 bronze badges
1
That worked! I figured Discord had changed something...you just saved me plenty of wasted hours. FYI, the only thing I did differently was add a config object with the header set to application/x-www-form-urlencoded
– Kyle Pendergast
Mar 28 at 6:49
add a comment |
1
That worked! I figured Discord had changed something...you just saved me plenty of wasted hours. FYI, the only thing I did differently was add a config object with the header set to application/x-www-form-urlencoded
– Kyle Pendergast
Mar 28 at 6:49
1
1
That worked! I figured Discord had changed something...you just saved me plenty of wasted hours. FYI, the only thing I did differently was add a config object with the header set to application/x-www-form-urlencoded
– Kyle Pendergast
Mar 28 at 6:49
That worked! I figured Discord had changed something...you just saved me plenty of wasted hours. FYI, the only thing I did differently was add a config object with the header set to application/x-www-form-urlencoded
– Kyle Pendergast
Mar 28 at 6:49
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55391068%2fdiscord-oauth2-receiving-invalid-client-error%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown