mirror of
https://github.com/jwilsson/spotify-web-api-php.git
synced 2026-04-27 16:05:51 +03:00
[GH-ISSUE #208] HTTP ERROR 500 with requestAccessToken #144
Labels
No labels
bug
docs
enhancement
enhancement
enhancement
feedback wanted
good first issue
help wanted
help wanted
help wanted
invalid
pull-request
question
question
upstream
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-web-api-php#144
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AndryGabry01 on GitHub (Nov 21, 2020).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/208
when i call the requestAccessToken method return me a HTTP ERROR 500
@jwilsson commented on GitHub (Nov 22, 2020):
Hi!
A few questions to help me understand what's going on:
requirecall looks a bit strange, have you installed the library via Composer or have you done it in some other way? (I was expecting something likerequire 'vendor/autoload.php';)$_GET['code']parameter will exist?require) and see if you're getting more detailed errors:Thanks!
@AndryGabry01 commented on GitHub (Nov 22, 2020):
i have use composer, but in the SpotifyApi directory.
when user login spotify, he is returned to callback.php
Fatal error: Uncaught SpotifyWebAPI\SpotifyWebAPIAuthException: Invalid client in /var/www/html/test/SpotifyApi/vendor/jwilsson/spotify-web-api-php/src/Request.php:65 Stack trace: #0 /var/www/html/test/SpotifyApi/vendor/jwilsson/spotify-web-api-php/src/Request.php(270): SpotifyWebAPI\Request->parseBody(Object(stdClass), 400) #1 /var/www/html/test/SpotifyApi/vendor/jwilsson/spotify-web-api-php/src/Request.php(115): SpotifyWebAPI\Request->send('POST', 'https://account...', 'client_id=cid&c...', Array) #2 /var/www/html/test/SpotifyApi/vendor/jwilsson/spotify-web-api-php/src/Session.php(235): SpotifyWebAPI\Request->account('POST', '/api/token', Array, Array) #3 /var/www/html/test/callback.php(9): SpotifyWebAPI\Session->requestAccessToken('AQCI-JJbxmWEClv...') #4 {main} thrown in /var/www/html/test/SpotifyApi/vendor/jwilsson/spotify-web-api-php/src/Request.php on line 65@jwilsson commented on GitHub (Nov 22, 2020):
Aha! You're getting a "Invalid client" error back from Spotify. I've seen this a few times before and the easiest solution seems to be to create a new Spotify app and use that instead.
@AndryGabry01 commented on GitHub (Nov 22, 2020):
I tried but keep giving me that error, now for safety I will try to re-download your api with the composer.
I update you
@AndryGabry01 commented on GitHub (Nov 22, 2020):
i tried to re download the api with composer, but script continue give me error
@jwilsson commented on GitHub (Nov 23, 2020):
Hmm, try changing these lines:
to this:
Right now you're calling the methods statically which means they won't have access to the access token. Creating an instance of the class and using that will make sure everything is set correctly.
@AndryGabry01 commented on GitHub (Nov 23, 2020):
hi, I managed to make everything work, I don't know what the problem was, probably my forgetfulness.
to fix it, I just went back to rewriting everything
in any case thank you very much for the help and sorry for the inconvenience.