CSI-280 / MusicGames

0 stars 0 forks source link

Implement Spotify API #16

Closed JCastaner closed 4 years ago

JCastaner commented 4 years ago

We should start implementing our APIs with the Spotify one considering how important it is to our project. All we really need is to make sure it works by console logging a couple examples from it.

A-Waters commented 4 years ago

Okay, So while working on this and after quite some thinking, I think the only way to do this and not break Spotify TOS is to have the user sign into their Spotify account. (It doesn't need to be premium?). We can then processed with the users by using the Spotify user ids in our DB to keep track of who has how much money ect... I think the dummy account can still be used for creating the playlist or we can do that just in the backend. #18

A-Waters commented 4 years ago

This would also mean that we would have to modify our login page for a different purpose (don't know exactly what it is yet but ill figure it out) #2

A-Waters commented 4 years ago

Update: I now know that the login button will open a new tab asking the user to authenticate themselves and then we will have a redirect page also known as ./frontend/gui/public/callback.html. This page will not be react based due to the fact that we would otherwise have to generate JS on the fly and inject it into a new page when it is externally loaded via specific URL based access.... which is above my head to figure out. The page is only on screen for 0.01 seconds so I'm not too worried. But it works now and isn't against Spotify TOS.

so the way we got this working is using a "secret token" (as all apps do) and it should be kept a secret. Because of this, I will soon be emailing everyone on the team a file with the secret inside. I added to .gitignore so hopefully, this won't be accidentally added to the GitHub for everyone to see.

Hopefully, in the future, we can just request the secret token from the backend of the server.. which is not set up to do yet but we can worry bout that some other time. once we figure out how Django works a little better. I don't think it will be difficult but I have no idea how to do it.

currently, all we have set up is logging in and asking Spotify API for the user ID. but it works.

will add more later.