Setting up TikTok Login - need Help

Hello to all,

I’m having a problem setting up a Tiktok login system on my app.

I am following the documentation at this address: TikTok for Developers | TikTok

From what I understand, I’m supposed to create a TikTok developer account to get my secrets keys and then set up the API via the Bubble API connector.

In the documentation it is written: “Create an Anti-Forgery State Token
You must prevent request forgery attacks to protect the security of your users. The first step before making the redirect request to TikTok’s authorization server is to create a unique session token to maintain the state between the request and callback.”

I’m not sure what I’m supposed to do at this point.

Has anyone set up the Tiktok login yet and can they help me?

Thanks in advance for your help!

1 Like

I need help with this too. @bootstrapperideas do you find solve for this ?

Yea it’s a url parameter called “state” and in bubble u can make this like so

state=Calculate Formula(Random String)

1 Like

Here’s an example of how you’d call their url authorization
Screenshot 2022-11-15 233700

1 Like

This is, like, so not helpful. Does TikTok have a user data endpoint? If so, none of this should be done manually, but should be done in the API connector and let Bubble handle the refresh tokens.

If TikTok does not have a user identity endpoint then the answer should be, “dude, this will not work easily for you”.

Because YOU KNOW the next question will be, “how do I exchange these tokens and stuff?” followed by, “what the heck do I do with these tokens, anyway?”

And when that time comes, I’ll help him out with his redirect handling his tokens via mentioned api connector. thanks for your input tho.

Thank you for your answer. As I understood, after Authorization via Tiktok I need run this action:


By this requst I have an error

Where is mistake. Can you help me?

And how I can Sign user up after that?

You go bro.

Uh oh!

@vitaly you won’t run that action directly after pulling up the outh site from tiktok. You’ll call that once your redirect page loads. Have you made your redirect page yet?

1 Like

Yes, I already figured it out. I have a page redirect, but I have an error in the request (I showed above) if this is a right request at all, I’m confused)

@vitaly looks like you’re missing your ‘grant_type’

grant_type=authorization_code

1 Like

grant_type=authorization_code - is this code that returned in string after tiktik autorization?

no you’re telling tiktok that’s what you’re requesting

1 Like

so you need to make a grant_type parameter with value authorization_code

1 Like

where I can find this authorization_code?

@vitaly the grant type is literally authorization_code

1 Like

Greate! But I can understand where I can find this authorization_code

@vitaly you’ve already found it. you keep typing it. the value you have to pass to be able to receive a token back is ‘authorization_code’

1 Like