vixitu
vixitu

Reputation: 43

Spotipy set redirect_uri

This is what I'm using right now to authenticate:

scope = "user-library-read"

SpotifyOAuth(client_id="9af97dea1d454457ae063fd20cb00740", client_secret="91baf6b3e5c44c71be017a136ac16a5f")
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope))

But it gives me this error:

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: SpotifyOauthError: No redirect_uri. Pass it or set a SPOTIPY_REDIRECT_URI environment variable.

I tried setting the redirect_uri as an argument, but it says it's an unexpected keyword argument. Is there any way I can set the redirect_uri (without environment variables)?

Upvotes: 0

Views: 1375

Answers (1)

Ximzend
Ximzend

Reputation: 448

Here is a part of my code I use I know works:

import spotipy
from spotipy.oauth2 import SpotifyOAuth
scope = "user-library-read"
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id="abcdef1234567890",client_secret="fedcba0987654321",redirect_uri="http://localhost:8080",scope=scope))

Upvotes: 1

Related Questions