Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

App retrieves my data for other users instead of theirs

App retrieves my data for other users instead of theirs

My Question or Issue

 

I've been trying to write some code that requires a user's playlist using the Spotify API. It works fine when I run the code on my computer and with my login details, but when I get my teacher to run it on their computer with them logged in, it still fetches my playlists instead of theirs, even though they are logged in. I'm using OAuth 2.0 for their login, so it should have no problem with fetching their data as I have all the correct scopes enabled. Additionally, since my app is in development mode, I have added my teacher's email that he uses for Spotify to the 'User Management' section of my API project. Here is my code:

def getUsersPlaylists(self, offset): # Returns playlist that the user has created and liked
        headers = {
            "Authorization" : f"Bearer {self.access_token}"
        }
        endpoint = 'https://api.spotify.com/v1/me/playlists?offset=' + str(offset) + '&limit=50'
        return requests.get(endpoint, headers=headers).json()

and here is the link to the documentation on the endpoint I'm using: https://developer.spotify.com/documentation/web-api/reference/get-a-list-of-current-users-playlists

I find it super strange that this is happening since, nowhere in my code do I store my own Spotify credentials anywhere in the code. This leads me to think that it is using my data because I am the one who created the API project.

If this is the case, is there a way I can get the playlist of the person actually logged in? Thanks to anyone who can help 🙂

Reply
0 Replies

Suggested posts