Redirect uri for multiple subdomains

Hello everyone,

I am working on an application that will have twitch login.
I am able to get everything working.
However, we have multiple environments - localhost, and
I use localhost for development, for testing and is our product.

The issue I am facing is that Twitch allows only one redirect_uri. How do I handle that I want the same user to be able to login into localhost, and website without changing the redirect_uri.
As of now, I end up changing the redirec_uri whenever I am doing dev work or testing.

One option I considered is to have three different twitch applications, but that means I will have to sign up using twitch for every test user on each of the three platforms and I do not like that solution.

Are there any alternatives?

Thank you!

1 Like

How do you store the information gathered? Are all tables contained within the same database? Could they be?

Perhaps some database magic would solve this for you by consolidating your login credentials and just using the one uri to populate the, let’s say, three tables in the db that require the information… This assumes that your database is ‘remote’ from the three domain containers.

It’s really stabbing in the dark until we know how you handle the information on the backend.

Yes, the DB is shared by all of them.
That is not a problem.

I am using django-social auth for my app.
The problem occurs when I have say as the redirect_uri on twitch.

Now, if I login using twitch on localhost, I get redirected to after login.
This is creating a problem.

Google allows having multiple redirect_uris and thus, this is not a problem with Google.

The alternative to registering multiple applications is to use a single redirect URI, which will then forward you to the desired domain using the state parameter.

What 3ventic said. My mistake for misunderstanding the question put forward.

Personally I’d use three applications.

Generally speaking in the world of development you would have separate Keys/Configs for dev, testing and production.

What @3ventic suggests is sound, but it means you leave in code in production that could err and send a user to the wrong domain and half the time the code is sat there slowing your website down as it does nothing but interrogate the state parameter for “where should I send this guy” when the redirect URI and Application Keys already decided this for you.

So three applications is the way to go in my opinion


Thanks, decided to use multiple apps instead of single app

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.