Announcements

Help Wizard

Step 1

NEXT STEP

Authentication not working in a live server | Django, Spotipy

Authentication not working in a live server | Django, Spotipy

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.

Aspecturu_0-1657497080193.png

I am running the live server in port 8000 and my redirect_uri's port is 8080.

 

Reply
1 Reply

Hello, were you able to resolve this??

Suggested posts