I am using Django and when I run a local server at localhost:8000, this piece of code works as intended:
spotipy.Spotify(
auth_manager=SpotifyOAuth(
redirect_uri=config["REDIRECT_URI"],
client_id=config["SPOTIPY_CLIENT_ID"],
client_secret=config["SPOTIPY_CLIENT_SECRET"],
scope="user-library-read user-library-modify playlist-modify-private playlist-modify-public",
cache_handler=spotipy.DjangoSessionCacheHandler(request),
)
).current_user()
It redirects me to http://localhost:8080/callback and fetches all the data by itself and caches the received token.
But when I do the same on a live server, it doesn't redirect me and the bash asks me to input the URL I have been redirected to.

I even tried including a false redirect_uri but it still asks me for the URL I have been redirected to. I have no idea what I am doing wrong, any help is appreciated.