I am able to get an authorization code (which is what I’m using to try to get an access token). I’m using this documentation as reference: TikTok for Developers
One thing I see as a difference is the use of the Cache-Control Header in the Bubble setup…in your screen shot from postman it looks like there are 11 Header values and not just 2 as you have in Bubble setup.
In Postman you’ve selected x-www-form-urlencoded, but in Bubble the data type is set to JSON as is the Body type.
Saying these things, I’m not implying what you have done is wrong, as I do not know how TikTok API works. I’m simply pointing out differences that I see that may be the reason for it working in Postman and not in Bubble.
Just in case you don’t have it yet. Response from Chat GPT:
Based on the images you’ve provided, it looks like there is a server error (HTTP status code 500) coming from the API you are trying to access. This usually indicates that something has gone wrong on the API’s end.
For the API request setup, you’re trying to obtain an access token from TikTok’s API, and your request setup seems to follow the instructions provided in their documentation. However, there are a couple of points that you might need to check:
Headers: Make sure that the Content-Type header is set to application/x-www-form-urlencoded if you’re sending the parameters in the body as form data, which is usually the case with OAuth token requests.
Body Parameters: The parameters should be sent as form data, not JSON. Your screenshot shows the body type is set to JSON, which is likely incorrect.
Client Key and Client Secret: Ensure that the client_key and client_secret are correct and have the proper permissions.
Authorization Code: The code should be a valid authorization code obtained after a user has authorized your application.
Redirect URI: Make sure that the redirect_uri matches exactly with the one you’ve set in your TikTok app settings.
Endpoint: Verify the endpoint you are hitting is correct and is the one specified for obtaining an access token.
If all the parameters are correct and the problem persists, it could be an issue with TikTok’s servers. You might want to wait and try again later or reach out to TikTok’s developer support for assistance.
Thanks @J805 and @boston85719 . I tried your suggestions but I am still getting an error. When I tried to set the body type as form-data, I’m getting this error:’
{“error”:“invalid_request”,“error_description”:“Only application/x-www-form-urlencoded is accepted as Content-Type.”,“log_id”:“20231204042125FD6EA0D0936E475C3343”}
Then when I try to set it to raw, I’m getting the 500 error still
Which shows you have the Content-Type set to the same value the error is stating it only accepts, and the fact that this type of issue has persisted in the API connector for sometime (issue being everything is set properly but Bubble sends wrong value and get error) and the fact that Bubble recently made an adjustment (usually based on historical track record means lots and lots of Bugs) I would assume this is a Bug in Bubble.
I think you can close the browser, clear the cache and history, then try again. If that doesn’t work, reach out to Bubble support who will at first say to look at the forum as they don’t help with API stuff, but clearly articulate the fact that you have added the correct Content-Type.