Unable to generate the Tiktok access token for web

3.8k views Asked by At

Here is my Request Post URL:

https://open-api.tiktok.com/oauth/access_token/?client_key=fgjvjhg&client_secret=ghhjgjhgjkhjk&code=Web&grant_type=authorization_code

Here is the response which I got:

{ "data": { "captcha": "", "desc_url": "", "description": "Authorization code expired", "error_code": 10007 }, "message": "error" }

Here is the documentation page which I am following: https://developers.tiktok.com/doc/login-kit-manage-user-access-tokens

Please help me with that, thanks in advance.

2

There are 2 answers

0
Boar On

You are missing 2 values there:

  1. Code (Authorization code from Web/iOS/Android authorization callback)
  2. grant_type (should always be set as authorization_code)

Example request:

https://open-api.tiktok.com/oauth/access_token/?client_key={{key}}&client_secret={{secret}}&code={{client_unqiue_id}}&grant_type=authorization_code
0
Max S. On

Check your code to make sure you're not making duplicate requests. A second request will invalidate the first one and you'll get Authorization code expired.