[Showcase] Manual OAuth2 Token Integration

Thank you for this post. This saved me after 3 days of effort.

1 Like

Great post - thank you!!

1 Like

Hey, This is amazing, I was experimenting with bubble and this helped me setup everything while using the Instagram basic display API.

I only had issues with the automation. Could you give a little more clarity on 5.2, 5.3, 5.4

  1. what is hubspot_scheduled_id
  2. What’s the endpoint logic
  3. Can you explain some of the logics and why they are in that order. I am complete noob at coding and not able to understand the logic

Thanks in advance!

Hey @ambroisedlg Thanks a ton for this. This is beyond amazing.

After breaking my head for a few days, I followed your steps to try and get Fitbit OAuth. I’ve gotten all the way upto 5 and now I can’t find the (body) code in my Token Actions. In the Get token action, I have a header, while the refresh token action has neither head nor body! Any idea where I may have messed up? Thanks a ton for this…

W

Thanks.

Hey @abhisheksebin9

This is a field in the User data type, used to store the API workflow’s ID. You then use this ID when you want to cancel a scheduled API workflow

What do you mean by that exactly?

You need to build the backend workflow in 5.3 in order to include it in your workflow on the “Auth” page in step 5.4 - so these 2 steps need to be in that order of course. However, you could go through the step 5.3 before going through the step 5.2, that wouldn’t have any impact.

Hope this helps!
Ambroise

Hey @hiwasim

This is probably because the “Private” checkboxes for your header and body in your API call is checked. If you uncheck it, you should be able to input dynamic data in your workflow action, just like for the “Get token” call

Cheers and hope this helps
Ambroise

1 Like

Hey @ambroisedlg
Thanks for this.
I completed the workflow without it and it seems to work for now, but I will try and implement your suggestion and see if it helps. Thanks again.

Hey hey, so I’ve got this working! Huge thanks to the amazing @ambroisedlg

Question: How do you actually sign users up and log them in (after you’ve successfully executed all these API steps)? Do you actually create an account for them? If so, what do you set as their password? When they log in later, how do you access their password? I’m confused on that final step.

Thanks so much.

2 Likes

Hello and thank you for such a detailed post! I was curious to see if anyone has managed to get this workflow functioning for the google API. I am currently working on it and having some trouble I managed to set up the API briefly using the bubble oauth user agent flow but once my token expired, I haven’t had any success in refreshing the token so I am looking at this manual flow instead.

I have my own setup for Google Calendar using a manual approach. One thing to note with the refresh token is you can only have one per account per app. This messed me when trying it on multiple test accounts.

Other than that, you need to save that refresh token when you get the initial token. When it’s time to refresh, here’s the action I use:

2 Likes

Since I only need my app to have access to the API, I was told that utilizing the JWT api via a service key was the best option. After some fiddling, I was able to get my app creating google docs and changing their permissions.

Hello - I’ve managed to get an authroisation code through the first steps. However when I go to swap it for a token it returns the following error:

Raw response for the API
Status code 400
{“status”:“BAD_AUTH_CODE”,“message”:“missing or unknown auth code”,“correlationId”:“054d9e9c-96fa-47c5-8737-71b1a7fcb002”}

this is the required body that i need. it doest require the code as mention is step 3.4 how do i go about this?

“client_id”:“xxxxx…”

“redirect_uri”:“https://yourwebsite.com/callback

“response_type”:“code”

“scope”:“public read write individual organization”

great!!! this post saved my project! gratitude. Now I’ve been able to make Facebook Marketing API calls that require the user’s access_token!

2 Likes

This is amazing, thank you so much for the write-up @ambroisedlg ! I think it is all working except for the fact that I don’t see any data saved? I’m assuming I’m supposed to see the token, refresh, and scheduled_id saved? Any ideas on how to fix it?

In addition the destination URL asked for nonce and I wasn’t sure what to include in that…

Thank you!

1 Like

I’ve got it setup but how do I use this to authenticate other HubSpot API calls?

@kalpi_desai glad you found it useful! Do you mean that the data is not saved in your DB even with the “Make changes to User” action in step 5.4? One reason might be that the “Hubspot - Get Token” is not returning any values. Try and play around on API Connector to see if something is not right!

The destination URL is different depending on which integration you’re trying to build - in Hubspot’s case, it’s https://app.hubspot.com/oauth/authorize?etc
You should be able to find the correct URL in your 3rd party’s API documentation, usually under the section OAuth

Let me know if that helps
Ambroise

1 Like

@benc you need to dynamically inform the token you save to the DB (in step 5.4) to authenticate API calls on behalf of a user. This is a quick example:

Hope this helps
Ambroise

1 Like

this is so helpful, I tested this out and you’re correct! The problem seems to be that the workflow “when page is loaded and code is not empty” doesn’t seem to run even though the page does refresh and I see a code in the URL after authorizing. Do I need to add another trigger or something to get this to run?

1 Like

I got it to work! I added the workflow “when page is loaded and code is not empty” to the index page instead of the auth page. Thanks for helping me!

Edit: Unfortunately, it takes a while to get the tokens and the index page is displayed :frowning:

1 Like