TikTok error 40110: invalid authorization code
TikTok error 40110 means the authorization code sent to /tt_user/oauth2/token/ is invalid: it was cancelled, it was already used, or it has expired. An Accounts API authorization code lasts 10 minutes and works only once. The fix is a new code, so send the account owner through the authorization URL again and exchange the new code straight away.
easyCoexistence runs the TikTok authorization for you: you sign in with TikTok from the dashboard, and the code is exchanged as soon as TikTok sends you back.
TikTok's return code for an authorization code that was cancelled, already used or has expired.
How long an Accounts API authorization code stays valid, against one hour for a Marketing API code.
How many times an authorization code can be exchanged for an access token.
TikTok account holder redirect URLs one developer app can configure, with one of them active at a time.
What does error 40110 mean?
TikTok refused the authorization code passed as auth_code to /tt_user/oauth2/token/. The return code appendix lists three causes: the code was cancelled, it was already used, or it has expired. Its example message reads "The auth_code is canceled. Please re-authorize and try again with a new auth_code." Whatever the cause, the fix is the same: a valid code.
How long is an authorization code valid?
For the Accounts API, 10 minutes, and it can be used only once. TikTok adds it to the redirect URL as a query parameter when the account owner approves the authorization, and once it expires the authorization steps start over. Marketing API codes last an hour, which is worth knowing when code written for that API is reused here.
How does a code get used twice?
The code travels in the redirect URL, so anything that loads that URL again or repeats the exchange can try to spend it a second time:
- The callback page is reloaded, or opened twice by the browser, and each load sends the same code.
- A retry repeats the token request after a timeout, although the first attempt may already have succeeded.
- Two parts of the app, such as the browser and the server, both exchange the code.
How do you fix it?
Start a new authorization. Send the account owner to the TikTok account holder authorization URL again; if they approved the same permissions before, TikTok skips the review page by default and redirects straight back with a new code. Exchange it once, within 10 minutes, on the server, with redirect_uri set to the redirect URL configured in the app, and store the tokens it returns.
Common mistakes
- Holding the code for later. It lasts 10 minutes, so exchange it as soon as the redirect arrives.
- Retrying with the same code after 40110. The code stays cancelled, used or expired, and only a new authorization gives one that works.
- Adding query parameters to the redirect URL. TikTok wants a static HTTPS URL ending in /, with any values the app needs carried in the state parameter.
- Sending a redirect_uri that differs from the one set in the app. TikTok's token endpoint requires the two to be the same.
If the sign-in cannot be completed, starting it again from the dashboard gets a new code, and Claude, ChatGPT or your own code then work with the connected account. US$ 9 to US$ 0.75 per connection per month, falling as you add connections, with the first 3 days free.
easyCoexistence is a multichannel API and MCP server that connects AI agents such as Claude and ChatGPT to WhatsApp, Instagram, TikTok, Facebook and more. On WhatsApp it uses Coexistence: the business keeps using its number in the WhatsApp Business app while the AI works through Meta's official API.
Frequently asked questions
Why does TikTok say the auth_code is canceled?
It is TikTok's example message for 40110: "The auth_code is canceled. Please re-authorize and try again with a new auth_code." The code was cancelled, already used or expired, and only a new authorization gives one that works.
Can a TikTok authorization code be reused?
No. Each code can be exchanged once, and a code that was already used is one of the causes TikTok lists for 40110.
Does the account owner have to approve every permission again?
Not by default. TikTok skips the review page for permissions the owner already approved, unless the authorization URL carries disable_auto_auth=1.
How is 40110 different from 40131?
40110 concerns the authorization code alone. 40131 is a broader authentication error at the token endpoints, whose causes include an expired code as well as a wrong app ID or secret.
Keep reading
Connect your first channel in two minutes.
No platform reviews to wait for. Connect WhatsApp, Instagram, TikTok or another channel, then ask your AI to post, reply or report, and watch it work.
- 3 days free
- Cancel any time
- Official APIs only
- Monitored 24/7
Verified on