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”}
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)
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
@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.
To get to the point, its my understanding that bubble during the users authorization is running “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.
@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” as separate call. So is Bubble not swapping out the code for the user_token then?
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.