# Error with Discord OAuth

**URL:** <https://forum.bubble.io/t/error-with-discord-oauth/242319>\
**Category:** APIs\
**Created:** [January 19, 2023, 1:04pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319 "2023-01-19T13:04:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![imaguru](https://avatars.discourse-cdn.com/v4/letter/i/71e660/32.png) [@imaguru](https://forum.bubble.io/u/imaguru)\
**Post date:** [January 19, 2023, 1:04pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/1 "2023-01-19T13:04:13Z")

</div>

Hello. Trying to setup Discor login and get this error:

API Connector error: the Oauth2 API Discord-login is not configured properly - Received error from api The service this service just returned an error (HTTP 401). Please consult their documentation to ensure your call is setup properly. Raw error: {“error”: “invalid\_client”} API Connector error: the Oauth2 API Discord-login is not configured properly - Received error from api The service this service just returned an error (HTTP 401). Please consult their documentation to ensure your call is setup properly. Raw error: {“error”: “invalid\_client”}

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/3/4/343df8653ddaf7dd68eabb4f288d60ce288f8bcf.png)

---

<div class="post-metadata">

**Author:** ![ambroisedlg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ambroisedlg/32/61966_2.png) [@ambroisedlg](https://forum.bubble.io/u/ambroisedlg)\
**Post date:** [January 19, 2023, 1:34pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/2 "2023-01-19T13:34:56Z")

</div>

hey @imaguru

I’m not familiar with Discord’s API but just a thought - have you tried removing all parameters from that URL in the Login dialog redirect field?

Based on the documentation it also looks like you shouldn’t have that /api in there

Try it again with https:// [discord.com/oauth2/authorize](http://discord.com/oauth2/authorize)

Ambroise

---

<div class="post-metadata">

**Author:** ![Jici](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jici/32/30722_2.png) [@Jici](https://forum.bubble.io/u/Jici)\
**Post date:** [January 19, 2023, 1:44pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/3 "2023-01-19T13:44:30Z")

</div>

Will add to @ambroisedlg but you shouldn’t have anything else than `https://discord.com/oauth2/authorize` in authorize endpoint (nothing after for the client id and other stuff… Bubble will add it for you)

---

<div class="post-metadata">

**Author:** ![imaguru](https://avatars.discourse-cdn.com/v4/letter/i/71e660/32.png) [@imaguru](https://forum.bubble.io/u/imaguru)\
**Post date:** [January 19, 2023, 3:23pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/4 "2023-01-19T15:23:25Z")

</div>

In this way I have another error  
 ![image](https://us1.discourse-cdn.com/bubble/original/3X/1/0/10637b8fedeb7f569ee24c20f2ab08fb476500a5.png)

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/c/0/c0553e4efaeb34bba5e7c2d005f31a67f4eb46cc.png)

---

<div class="post-metadata">

**Author:** ![Jici](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jici/32/30722_2.png) [@Jici](https://forum.bubble.io/u/Jici)\
**Post date:** [January 19, 2023, 4:06pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/5 "2023-01-19T16:06:01Z")

</div>

Where or when do you have this error?

---

<div class="post-metadata">

**Author:** ![imaguru](https://avatars.discourse-cdn.com/v4/letter/i/71e660/32.png) [@imaguru](https://forum.bubble.io/u/imaguru)\
**Post date:** [January 19, 2023, 4:13pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/6 "2023-01-19T16:13:53Z")

</div>

Here, when I tried login with discord  
 ![image](https://us1.discourse-cdn.com/bubble/original/3X/e/a/ea4276cf9bc7996934251bc62011be653520ae8a.png)

---

<div class="post-metadata">

**Author:** ![ambroisedlg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ambroisedlg/32/61966_2.png) [@ambroisedlg](https://forum.bubble.io/u/ambroisedlg)\
**Post date:** [January 19, 2023, 4:30pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/7 "2023-01-19T16:30:41Z")

</div>

@imaguru not sure why’re you’re having this error - any reason why you’re not using the Discord Auth plugin though, instead of API Connector?

---

<div class="post-metadata">

**Author:** ![Jici](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jici/32/30722_2.png) [@Jici](https://forum.bubble.io/u/Jici)\
**Post date:** [January 19, 2023, 4:46pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/8 "2023-01-19T16:46:09Z")

</div>

Can you show the url you have when you click on the signup button?

---

<div class="post-metadata">

**Author:** ![ambroisedlg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ambroisedlg/32/61966_2.png) [@ambroisedlg](https://forum.bubble.io/u/ambroisedlg)\
**Post date:** [January 19, 2023, 4:54pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/9 "2023-01-19T16:54:02Z")

</div>

@imaguru this config worked for me

 ![CleanShot 2023-01-19 at 17.52.12](https://us1.discourse-cdn.com/bubble/original/3X/8/2/8276e48cafb4e1cd6b4bec70585fca9c08142ada.png)

Note that the URLs are not the same `https://discordapp.com/` instead of `https://discord.com`

---

<div class="post-metadata">

**Author:** ![imaguru](https://avatars.discourse-cdn.com/v4/letter/i/71e660/32.png) [@imaguru](https://forum.bubble.io/u/imaguru)\
**Post date:** [January 19, 2023, 4:57pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/10 "2023-01-19T16:57:26Z")

</div>

I tried few plugins and I have errors with all of them

---

<div class="post-metadata">

**Author:** ![imaguru](https://avatars.discourse-cdn.com/v4/letter/i/71e660/32.png) [@imaguru](https://forum.bubble.io/u/imaguru)\
**Post date:** [January 19, 2023, 5:00pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/11 "2023-01-19T17:00:40Z")

</div>

> [@ambroisedlg](#):
>
> [https://discordapp.com/](https://discordapp.com/)

Change to [https://discordapp.com/](https://discordapp.com/) but still have this error. Mayby problem in discord app?

---

<div class="post-metadata">

**Author:** ![imaguru](https://avatars.discourse-cdn.com/v4/letter/i/71e660/32.png) [@imaguru](https://forum.bubble.io/u/imaguru)\
**Post date:** [January 19, 2023, 5:03pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/12 "2023-01-19T17:03:05Z")

</div>

> **[Discord - A New Way to Chat with Friends & Communities](https://discord.com/oauth2/authorize?client_id=1062335892833964032&redirect_uri=https:%2F%2Fimaguru.host%2Fapi%2F1.1%2Foauth_redirect&response_type=code&state=%257B%2522debug_mode%2522%253A%2522true%2522%252C%2522oauth_provider%2522%253A%2522apiconnector2-cmjqm%2522%252C%2522resume_key%2522%253A%25221674147665613x465100227164646300%2522%252C%2522used_redirect_url%2522%253A%2522https%253A%252F%252Fimaguru.host%252Fversion-test%252Flogin-s10%252Fsignup%252F%253Fdebug_mode%253Dtrue%2522%252C%2522redirect_unique_id%2522%253A%25221674147665989x613458061407708000%2522%257D&scope=email%2Bidentify)**
>
> Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.

---

<div class="post-metadata">

**Author:** ![Jici](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jici/32/30722_2.png) [@Jici](https://forum.bubble.io/u/Jici)\
**Post date:** [January 19, 2023, 5:07pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/14 "2023-01-19T17:07:39Z")

</div>

this url work for me but there’s an error in the space between your scopes  
this is the url you should get;  
`https://discord.com/oauth2/authorize?client_id=1062335892833964032&redirect_uri=https:%2F%2Fimaguru.host%2Fapi%2F1.1%2Foauth_redirect&response_type=code&state=%257B%2522debug_mode%2522%253A%2522true%2522%252C%2522oauth_provider%2522%253A%2522apiconnector2-cmjqm%2522%252C%2522resume_key%2522%253A%25221674147665613x465100227164646300%2522%252C%2522used_redirect_url%2522%253A%2522https%253A%252F%252Fimaguru.host%252Fversion-test%252Flogin-s10%252Fsignup%252F%253Fdebug_mode%253Dtrue%2522%252C%2522redirect_unique_id%2522%253A%25221674147665989x613458061407708000%2522%257D&scope=email%20identify`

---

<div class="post-metadata">

**Author:** ![imaguru](https://avatars.discourse-cdn.com/v4/letter/i/71e660/32.png) [@imaguru](https://forum.bubble.io/u/imaguru)\
**Post date:** [January 19, 2023, 5:07pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/15 "2023-01-19T17:07:57Z")

</div>

Are there should be any link ?

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/f/1/f1af7227247c278fa77eb306fc6bc8f58f0653da.png)

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/f/1/f11893c79601a079d75db1a0b75d34f96a93b679.png)

---

<div class="post-metadata">

**Author:** ![ambroisedlg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ambroisedlg/32/61966_2.png) [@ambroisedlg](https://forum.bubble.io/u/ambroisedlg)\
**Post date:** [January 19, 2023, 5:11pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/16 "2023-01-19T17:11:11Z")

</div>

@imaguru

> [@imaguru](#):
>
> Are there should be any link ?

I didn’t put any links there, just the redirect\_uri in the OAuth2 screen

Also maybe a dumb question but worth checking - you got your App Secret from there, right?

 ![CleanShot 2023-01-19 at 18.09.29@2x](https://us1.discourse-cdn.com/bubble/original/3X/5/3/5356b7a9d993c533221c5690ed6755f56e7f7ecf.png)

---

<div class="post-metadata">

**Author:** ![imaguru](https://avatars.discourse-cdn.com/v4/letter/i/71e660/32.png) [@imaguru](https://forum.bubble.io/u/imaguru)\
**Post date:** [January 19, 2023, 5:16pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/17 "2023-01-19T17:16:53Z")

</div>

> [@ambroisedlg](#):
>
> I didn’t put any links there, just the redirect\_uri in the OAuth2 screen
> 
> Also maybe a dumb question but worth checking - you got your App Secret from there, right?

Nope. I am idiot… used public key instead of secret key. Thank you so much

---

<div class="post-metadata">

**Author:** ![ambroisedlg](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ambroisedlg/32/61966_2.png) [@ambroisedlg](https://forum.bubble.io/u/ambroisedlg)\
**Post date:** [January 19, 2023, 5:19pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/18 "2023-01-19T17:19:17Z")

</div>

No problem!

---

<div class="post-metadata">

**Author:** ![3ddesignbros](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/3ddesignbros/32/180657_2.png) [@3ddesignbros](https://forum.bubble.io/u/3ddesignbros)\
**Post date:** [March 4, 2025, 2:07pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/19 "2025-03-04T14:07:25Z")

</div>

@ambroisedlg sorry for the tag on a post that’s 2+ years old but I’ve searched forever and this post is as close as I can get to getting my issue figured out.

I’m also assuming my issue is just my ignorance we how bubble handles the code/token during the OAuth2 process.

I’m trying to allow uses to Join a private discord with role assignment after they sign up for my app.

I’m able to complete the OAuth2 process as you can see in the screen shot below.

 ![CleanShot 2025-03-04 at 07.53.46](https://us1.discourse-cdn.com/bubble/original/3X/f/2/f219328df85b0c6323e21e3e6aab08bd59ed3793.png)

My issue comes with setting up additional calls after that authorization. I’m trying to join the user to my sever with the designated role.

 ![CleanShot 2025-03-04 at 07.59.48](https://us1.discourse-cdn.com/bubble/original/3X/1/a/1a12f4ef4944cef0cd94a4417a1544dbd875179a.png)

According to the Discord Docs all parameters are optional expect for the access\_token.

 ![CleanShot 2025-03-04 at 08.01.18](https://us1.discourse-cdn.com/bubble/original/3X/2/6/26c7f135a5ba6acb1b64d06cf7b1f20b5f5e76d2.png)

To get to the point, its my understanding that bubble during the users authorization is running “[https://discordapp.com/api/v9/oauth2/token](https://discordapp.com/api/v9/oauth2/token)” and is getting their access\_token. Is that true?

If that is true how do I locate it so I can initialize my “join server” call? I’ve tried doing it without it and I get an “unauthorized” response.

I’ve also tried to save the token upon the redirect but the only data options are the users ID and Email.

 ![CleanShot 2025-03-04 at 08.04.19](https://us1.discourse-cdn.com/bubble/original/3X/4/1/41ac1835b8465cefa996439b8a154c4650483591.png)

@draked123 sorry for bringing you in as well but I saw a post from you where it looks like you do the “[https://discordapp.com/api/v9/oauth2/token](https://discordapp.com/api/v9/oauth2/token)” as separate call. So is Bubble not swapping out the code for the user\_token then?

Any help from anyone is appreciated.

---

<div class="post-metadata">

**Author:** ![draked123](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/draked123/32/262422_2.png) [@draked123](https://forum.bubble.io/u/draked123)\
**Post date:** [March 4, 2025, 2:23pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/20 "2025-03-04T14:23:28Z")

</div>

Hey!

It has been a long while since I’ve messed with Discord’s OAuth and tokens, but if I recall correctly, myself and @johnny were unable to get the tokens to properly refresh or store in the Bubble database when using the API Connectors `OAuth2 User-Agent Flow`, so we managed the tokens directly ourselves when building this out, and used `None / Self-handled`.

Each user had a table entry for storing both their refresh token and their auth token. If you go this route, especially if you’re granting the Join servers permission, **ensure** you have strict privacy rules. We also stored the token expiration, and created a scheduled API call to refresh the auth token daily so we didn’t lose it.

It’s been years since I’ve touched the API, this is just all what I can recall directly from memory. I know once we solved this initial problem, hooking up the rest of the calls was really a breeze.

---

<div class="post-metadata">

**Author:** ![3ddesignbros](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/3ddesignbros/32/180657_2.png) [@3ddesignbros](https://forum.bubble.io/u/3ddesignbros)\
**Post date:** [March 5, 2025, 2:04pm UTC](https://forum.bubble.io/t/error-with-discord-oauth/242319/22 "2025-03-05T14:04:03Z")

</div>

Thanks @draked123 I managed to get it to work by using the `None / Self-handled` and handling the tokens in the DB.

Thanks for the tip.
