Help Wizard

Step 1


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 = '' + 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:

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 🙂

0 Replies

Suggested posts