[GH-ISSUE #837] Authentication not working in a live server | Django #514

Closed
opened 2026-02-27 23:23:04 +03:00 by kerem · 0 comments
Owner

Originally created by @Aspecky on GitHub (Jul 10, 2022).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/837

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 terminal asks me to input the URL I have been redirected to.
image

Originally created by @Aspecky on GitHub (Jul 10, 2022). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/837 I am using Django and when I run a local server at `localhost:8000`, this piece of code works as intended: ```py 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 terminal asks me to input the URL I have been redirected to. ![image](https://user-images.githubusercontent.com/60469830/178128962-b2a0b86b-e600-4c85-bcf0-628e560e0e71.png)
kerem 2026-02-27 23:23:04 +03:00
  • closed this issue
  • added the
    question
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#514
No description provided.