makandz/MySpotify

Auth Loop

Opened this issue · 4 comments

I'm trying to run this on localhost. I have installed composer and have run the command where the other files are located, I have also updated the configuration.php file to have the correct details. My spotify application has the correct redirect uri set too.

However, when I try to link my spotify, it redirects me back to index.php with a newly generated access token but no access to the dashboard. Here's an image probably better explaining what I mean:

Annotation 2020-04-26 171156

and here is what happens when I set "**value**" = **true** inside SpotifyStats.php:

image

Any support is much appreciated!

Many thanks,

Michael

Hey Michael, try adding auth.php to the end of your configuration file. It seems like your Spotify identification is returning to the homepage instead of the authentication page ^^

eg. If your configuration.php file contains http://localhost/mySpotify/, try changing that to http://localhost/mySpotify/auth.php.

Let me know if it works :)

Thanks, it works now!

as a side note, you could change
try {
$userProfile = $Spotify_API->me(); // Get user from token.
// Update user information.
$User = [
"valid" => true,
"username" => $userProfile->id
];
}

to:

try {
$userProfile = $Spotify_API->me(); // Get user from token.
// Update user information.
$User = [
"valid" => true,
"username" => $userProfile->display_name
];
}

inside the SpotifyStats.php file.

It just looks nicer than the id :)

Many thanks,

Michael

I'll definitely consider thanks! If you want you can send a pull request and I can merge it too :)