We are implementing "Log in with Tiktok" on our website. We are able to redirect users to Tiktok and get user initial authorization according to the instructions on this link:
https://developers.tiktok.com/doc/login-kit-web/
However, when we follow the instructions on this TikTok page to get access token
https://developers.tiktok.com/doc/login-kit-manage-user-access-tokens
we always get this error:
{"data":{"captcha":"","desc_url":"","description":"Enter the correct parameter","error_code":10002},"message":"error"}
We are using Java and this is our code:
URIBuilder builder = new URIBuilder("https://open-api.tiktok.com/oauth/access_token/");
HttpPost post = new HttpPost(builder.build());
post.setHeader("code", code);
post.setHeader("grant_type", "authorization_code");
post.setHeader("client_key", "client key goes here"));
post.setHeader("client_secret", "client secret goes here");
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpResponse httpResponse = httpclient.execute(post);
We found this related link at SO
TikTok Oauth - Parameter error (Login kit)
but have no idea of how to do it in Java. Anybody knows the correct way to obtain access token from TikTok in Java?