[PR #4437] [MERGED] fix(tiktok): refresh token flow uses client_key #5383

Closed
opened 2026-03-13 12:20:59 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4437
Author: @Manokii
Created: 9/4/2025
Status: Merged
Merged: 9/4/2025
Merged by: @himself65

Base: canaryHead: canary


📝 Commits (1)

  • 1b2eeba fix(tiktok): refresh token flow uses client_key

📊 Changes

1 file changed (+4 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/social-providers/tiktok.ts (+4 -1)

📄 Description

Bug

Refreshing a tiktok access token returns null

Steps to reproduce

  • link a tiktok account
  • run auth.api.refreshToken()
  • results shouldn't be null

Fix

I've check the tiktok docs, they use client_key instead of client_id, so I added it as an extraParams

tiktok oauth2 docs https://developers.tiktok.com/doc/oauth-user-access-token-management#2._refresh_an_access_token_using_a_refresh_token


Summary by cubic

Fixed TikTok token refresh by sending client_key to the v2 token endpoint via POST as required by TikTok OAuth2. auth.api.refreshToken() for TikTok now returns a valid access token instead of null.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4437 **Author:** [@Manokii](https://github.com/Manokii) **Created:** 9/4/2025 **Status:** ✅ Merged **Merged:** 9/4/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `canary` --- ### 📝 Commits (1) - [`1b2eeba`](https://github.com/better-auth/better-auth/commit/1b2eeba910fbabd8caf32a639c014d9160d036f3) fix(tiktok): refresh token flow uses client_key ### 📊 Changes **1 file changed** (+4 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/social-providers/tiktok.ts` (+4 -1) </details> ### 📄 Description ### Bug Refreshing a tiktok access token returns null ### Steps to reproduce - link a tiktok account - run `auth.api.refreshToken()` - results shouldn't be null ### Fix I've check the tiktok docs, they use `client_key` instead of `client_id`, so I added it as an `extraParams` tiktok oauth2 docs https://developers.tiktok.com/doc/oauth-user-access-token-management#2._refresh_an_access_token_using_a_refresh_token <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixed TikTok token refresh by sending client_key to the v2 token endpoint via POST as required by TikTok OAuth2. auth.api.refreshToken() for TikTok now returns a valid access token instead of null. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:20:59 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#5383