[Help needed]Created needed api but its not working inside bubble need help 0w0

Step A) Authorize url. User authorize your app. Get redirected to your app. URL will contain code
Step B) API Connector: use the token endpoint. Use the code from the url (this expire fast, so you must be ready after redirection). Initialize API call. You should get the call initialized correctly like in your screenshot. Save this but before, click on show raw data and copy the access token.
Step C) Create an API endpoint that call user informations for example. Set a header with Authorization and in the value Bearer accesstoken

Continue to create API Calls using C step.

What actually create alot of confusion is that your are using a authorize url ā€¦ This is only if you want, for example me, to give YOUR app authorization to make API call on behalf of me. This is what we call an authorize code grant. If you donā€™t need that, and want to use YOUR credentials (your bot for example) or if you plan to ask user to provide their API key and secret, your will use client credentials.
But all of them will need you to set none for the Bubble authentication part because you are doing this manually.
Actually, some of your screenshot show it work.

So the first question to answer is: who will authenticate? You? Your Bots added to their app? Your user? Each of them have a different process.

1 Like

ohhhhh lol my bads m8

Authorize will also be needed if you want your bots added to their discord. This is a different process, but it will use authorize too

i have the add bot to guild DisList.Me Contributor Profile | Bubble just look at the plugin calls i have everything needed but just this access_token exchange is the confusing part for me so please give me a few to go over what you typed like i said im visual
:pray: again your a blessing in disguise btw lol

Did you activate this:
REQUIRES OAUTH2 CODE GRANT
in bot?

yes m8 ive done everything made a bot api for bot calls with a none or selfhandled but i try setup the token exchange via that api plugin its a no go its unauthorized to make call

I have oauth plugin to handle oauth

and the 3rd plugin being dealt with atm is this darn token exchange lol so idk why its not working this plugin works fine but once i add to bubble it cant get access token or save it or anything :cry:

I will re-attempt to add the call via my bot api as its none or selfhandled once again but if i get same error from a proper setup its just more wasted time ive been up 4 days and on this 8 days

@Jici heres what the bot api top looks like i guess the auth area or call type area


yes i know my token and secret there but you cant see it all and the Bot documentation area one is a fake so no issues there just to explain how its put in

i tried with out those headers got errors lol - discord is fussy with there api calls kinda lol but cant blame them when you got millions of accounts to keep secure

did what u told me too


like i said my calls are right just something fishy going on with bubble or obtaining the data

funny how with one line of code POOF this can work but bubble its been nothing but jumping hoops to get it too work (i do hope if you read this bubble.io team you consider making this easier for users in future)

1 Like

i like to negate that last part i had a typo and didnt notice lol applicationx-www-form-urlencoded of course wont work oops i missed a /

but this would still provide me the bots token and not the users access_token which is all i need to thus then add the user to my server on discord boom solution found

Hey @Jici this repsonse below is my bots token from the api like stated

{
    "access_token": "FSV52GsanQQEk4qICQHZeU0VhKNIky",
    "expires_in": 604800,
    "scope": "identify",
    "token_type": "Bearer"
}

for bot owners to test their bots and such ive already refresh my token above for security

Can you create a video of the process you have set from the authorize to the token part including the response of the token part?

i can using loom if you give me some time to get it all setup on my pc but more or less it will be a long video thats the issue at hand as id be showing you everything step by step from the plugin to the login to the saved code from url to db to the access token maybe im doing this wrong my end to swap the code for token lets find out from the video lol if you had google remote desktop https://remotedesktop.google.com/support it make both our time easier tbh its secure as well

@Jici guess im installing loom brb

1 Like

@Jici heres a video i dont know if im doing things right here but as you see the code is saved to user as well so i know im using parameter right to obtain ?code=this_value_obatined_here

Pc froze for first 4-7 seconds there lol

Thereā€™s no sound on your video so I cannot hear comments.
Actually Iā€™m more lost on your issue because you seem to use the Signup/login using social network from Bubble using API Connector auth ā€œoAuth2 User-agentā€. If this is the case, you donā€™t need to care about the authentication. Bubble will handle all of that for you.
Also, in your video, I didnā€™t see you asking to authorize your Bot, only user scopes. So you cannot use your Bot to make request.
Please, share your API Connector settings too and your authorize url if you are doing stuff manually

your not understanding the need of the access_token i need this token to allow my bot to add user to my discord server after logging in hence in video i run my mouse over the - join to guild - in the oauth of discord anyways i got the code working but now am being provided wrong token i know its not wrong token as i will show u in another video using a test account

anyways i got the code part fixed but now its the token exchange for the code is the issue i know the code works to get the token cause i run it threw the plugins and it works like i will show in video just give me a few also good morning m8

also no comments in video were made

@Jici Loom | Free Screen & Video Recording Software

i pray and hope this helps you in understanding what im attempting todo Discord Developer Portal is the source for what im attempting todo add-guild-member

please note i have it working to get code i cant save data or call data from db as it expires in that time frame so i get data from url for the token exchange and move on to my next steps (which now tbh is the farthest ive been in this whole issue in 9 days and counting )
refresh said token with new refresh_token and use that new access_token provided to add member to guild and refresh token one last time for a security measure on my sites end but i cant get the token to come back right keeps giving me wrong token but yet as we see in video im using the same calls and everything so im confused


its getting code but providing back wrong token idk what todo ive tried to even add a refresh token step in prior and it wont work

No you donā€™t need the access token to allow your bot. You need to add ā€œbotā€ scope to the list of scope in the authorize request. When you do that, the user first authorize your app to access user account and a second authorize screen will ask to add bot.
Check my manual example (In my example, Iā€™m using manual auth processā€¦ but you can probably use the oAuth User-Agent flow too. But split the Bot calls into another API in this case):

First: Get authorization for user AND bot: https://nimb.ws/vC615H ā€¦ check my scopes list that include bot. Also need to include permissions parameters. Check the authorize screen that ask me twice to authorize. First my user account and second to add bot with admin rights.

Second: Call with Access token from user after the code and call with bot token.