Important information : I’ve creat and app on the TikTok Developer portal and I’ve been approved by TikTok admin. The App’s status is “Live in production”.
I click on “Connect my account”, it opens a second windows and I have the authorisation page : I connect to my TikTok account, “Do you allow the app…blablabla…to access to your informations…blablabla”.
I click on “Accept” and here is the final window I see :
I’m not entirely sure how oauth or rather how it works in tiktok’s backend. But I looked into janus. It is probably this: https://janus.conf.meetecho.com/
No changing the client ID is not for the screenchot but that doesn’t make any différence because TikTok API doesn’t respect strictly OAuth 2 specifications.
TikTok doesn’t use the value “client-id” but rename it “client-key”. That’s why you can see “client_key=xxxxxxxxxxxxxxxxxxx” in the Auth URI Query Parameters.
I think that creditentials doesn’t replic the “Auth URI Query Parameters” in the access token URL. Maybe that’s why I have this problème.
Sadly the community node does not work due to it crashing in one of its helpers function. I did create a PR that ‘might’ fix it but the repo seems dead.
But the bearer access_token seem not to be set or added in header correctly for futur requests:
NodeApiError: Unable to sign without access token at ExecuteContext.execute (/home2/xxxxxx/nodevenv/n8nApp/20/lib/node_modules/n8n-nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts:752:15)
So we have seen this issue with other custom Oauth designs with other clients/services and n8n.
We integrated with upwork oauth, and similar issue. There is no proposed solution by the dev team.
They “approved” my other solution where the current recommendation if internal oauth does not work, is to handle it manually, and store the refresh and api token in a database or google sheet.
Then each time you make the request with the token (manually, not saved to a credential in n8n), before that you would fetch the old token and refresh from the db, and refresh it, save it back, and use that.
We had to do that with a couple of clients. Its not pretty, nor a fix of the native oauth feature, but it works very well.
Still looking for solution…
Does anyone know why is that the OAuth2 flow says “connected” but token was not added in the reuqest? I haven’t got time yet to look at the source code, but I am wondering is it OAuth2 never actually finished successfully, or it succeeded but token was not “cached” or “extracted” later correctly due to uniqness of TikTok auth flow?