Now, if I take the token from postman that is generated, I can use it and make API calls from Bubble this way:
(I fill the values from a form fill on the app)
What I am trying to accomplish is that the user on my SaaS app can connect to their service titan, and then use the data elsewhere in the app through api call actions.
I am thinking they need to connect (initialize the token) and then store the token to use in subsequent calls… this token refreshes but I am not there yet, right now, I want to get the call working…)
The first thing is that you should use Custom oAuth token instead of manually add the authorization token to all call. Probably you will pass the value as https://auth-integration.servicetitan.io/connect/token?grant_type=client_credentials&client_id=YOURCLIENTID&client_secret=YOURCLIENTSECRET (and maybe set the header for content-type= application/x-www-form-urlencoded (don’t use shared header but token call header. But this is probably not needed)
This way, you will not need to manually add authorization header to all call. Bubble will do it for you.
In the first screenshot, it probably didn’ work because you didn’t select POST… Also, shared header shouldn’t be set for the content-type: application/x-www-form-urlencoded. You will have a conflict with other call that will need application/json.
Hey I am unable to get this to work. Can you confirm your setup?
Did you keep your 1st section body as that JSON snippet?
If you selected Raw as Body type in the 2nd section, is this the literal payload:
grant_type=client_credentials&client_id=&client_secret=
or did you put your creds in there? I feel like I’ve tried every which way based on yours and Jicis recommendations (I have indeed tried putting my creds after each = sign, and data type JSON in that second section there) and I just cannot figure it out. I’ve been successful in python using requests and BASH using curl but not here. TIA
You don’t need to use an API call + custom token
Your request in oauth2 custom token section use JSON while request should be x-www-form-urlencoded. This is what you are doing in API Call (but not correcly…). You should use that in Body for token. Nothing should be dynamic with client credentials…
If it doesn’t work in body, try to put everything in the url directly like ?grant_type=client_credentials&client_id=yourclientid&client_secret=yourclientsecret
In Body:
?grant_type=client_credentials&client_id=cid.1234&client_secret=cs1.1234
grant_type=client_credentials&client_id=cid.1234&client_secret=cs1.1234
Nothing seems to be working. Usually when I am debugging BASH curls/python requests I can at least see the form of the request as it is sent, so that I may check if there are syntax issues,. Here, however, I do not have the ability to do so here and not sure how to proceed.
Remove the ? in body, you don’t need it. After, add an API call, not the token one. This is done by Bubble with auth. Like https://api.servicetitan.io/crm/v2/tenant/{tenant}/export/leads (Replace tenant by your value)