TikTok Shop OAuth2 404 Error

Can anyone help with an OAuth2 issue I’m running into with TikTok shop?

I’m getting a 404 error during the authentication handshake.

When I manually attempt to hit this URL (as provided by TikTok) I’m given the access token, refresh token and so on, but n8n returns a 404 error when trying to do the handshake. I’m wondering if n8n sends code instead of auth_code in the query parameters?

https://auth.tiktok-shops.com/api/v2/token/get?app_key={{app_key}}&app_secret={{secret}}&grant_type=authorized_code&auth_code={{code}}

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @scottyb!, thanks for reaching out!

I couldn’t find the url structure you referenced in the TikTok Shop API documentation.

I recommend you start there and use their API Testing Tool to ensure you are structuring requests to their endpoints correctly prior to building out functionality in a workflow.

Happy building!

Hi Ludwig,

Thanks for the reply :slight_smile:

The TikTok docs are here (you can search the page for https://auth.tiktok-shops.com/api/v2/token/get to see that part of the docs), and their requirements for signing requests is here.

The structure is definitely correct as I’m able to generate the API key manually, just not when using the OAuth2 flow in the HTTP Request Node.

i am having the same issue, do you had a solution?

I ended up doing this the old fashioned way by spinning up some middleware and writing code. I used this library, which handles all the signing of requests properly: GitHub - EcomPHP/tiktokshop-php: Tiktok Shop API Client in PHP. Use API version 202309 and later

Unfortunately using N8N won’t work because TikTok has used their own method of signing requests, which the N8N HTTP Request node can’t support.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.