TikTok api user/info/ endpoint return error code 6007063

Viewed 324

I implemented TikTok PI and everything works well. In the last days I encountered a problem that the user/info/ endpoint returns 'error code': '6007063', 'message': 'auth user info is required'. This is happening for some of the accounts while others succeeded (there is nothing different between the accounts), I guess it's on tiktok side.

var Client = new HttpClient();
var userDataRequest = new UserDataRequest
{
    open_id = tokenObj.data.open_id,
    access_token = tokenObj.data.access_token,
    fields = new HashSet<string> { "open_id", "union_id", "avatar_url", "avatar_url_100", "avatar_url_200", "avatar_large_url", "display_name" }
};

var json = JsonConvert.SerializeObject(userDataRequest);
var body = new StringContent(json, Encoding.UTF8, "application/json");

var response = await Client.PostAsync("https://open-api.tiktok.com/user/info/", body).ConfigureAwait(false);

How can I solve the problem and what does this error mean?

https://developers.tiktok.com/doc/login-kit-user-info-basic

2 Answers

I encountered the same issue and I found that the way I refresh the access token is incorrect. POST https://open-api.tiktok.com/oauth/refresh_token/

For this API, we should put client_key, grant_type, and refresh_token in the query instead of in the body or post data. POST https://open-api.tiktok.com/oauth/refresh_token/?client_key={my_client_key}&grant_type=refresh_token&refresh_token={my_client_token}

This solves my problem. Maybe you could check the way you refresh your access token to solve this issue.

Indeed, all data should be in the link, and not in the body of the request. And then when receiving a token by reference https://open-api.tiktok.com/oauth/access_token/ it works correctly when using it further

Doc: https://developers.tiktok.com/doc/login-kit-manage-user-access-tokens/

let url_access_token = 'https://open-api.tiktok.com/oauth/access_token/';
    url_access_token += '?client_key=' + CLIENT_KEY;
    url_access_token += '&client_secret=' + CLIENT_SECRET;
    url_access_token += '&code=' + code;
    url_access_token += '&grant_type=authorization_code';
Related