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;








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!










share|improve this question
































    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!










    share|improve this question




























      0












      0








      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!










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 28 at 6:46







      Kyle Pendergast

















      asked Mar 28 at 6:02









      Kyle PendergastKyle Pendergast

      506 bronze badges




      506 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          3
















          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"
          )





          share|improve this answer




















          • 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











          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
          );



          );














          draft saved

          draft discarded
















          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









          3
















          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"
          )





          share|improve this answer




















          • 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
















          3
















          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"
          )





          share|improve this answer




















          • 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














          3














          3










          3









          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"
          )





          share|improve this answer













          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"
          )






          share|improve this answer












          share|improve this answer



          share|improve this answer










          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













          • 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







          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.




















          draft saved

          draft discarded















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현