'Tiktok login kit redirect_uri on localhost

i'm trying to implement the tiktok login kit, but i'm having problems with the redirect_uri on localhost. Localhost can't be defined on the tiktok developers applications, so when i reach tiktok with redirect_uri=localhost, it throws an error page.

Do i need to define in my host file the real url, or is there any workaround?



Solution 1:[1]

There is a tool called ngrok that helps in these cases where you need a public url.

After installation and config you can do this in a terminal:

ngrok http 8000

And you will see something like this:

ngrok                                                                                                                                                         (Ctrl+C to quit)

Session Status                online
Account                       inconshreveable (Plan: Free)
Version                       3.0.0
Region                        United States (us)
Latency                       78.006541ms
Web Interface                 http://127.0.0.1:4040
Forwarding                    https://84c5df439d74.ngrok.io -> http://localhost:8000

Connections                   ttl     opn     rt1     rt5     p50     p90
                              0       0       0.00    0.00    0.00    0.00

So from the outside (any other machine not only your local pc) you can request to this url https://84c5df439d74.ngrok.io and will forward the requests to localhost:8000

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 anibal jasin