mirror of
https://github.com/jwilsson/spotify-web-api-php.git
synced 2026-04-27 07:55:49 +03:00
[GH-ISSUE #184] Authorization Code Flow's Error: Uncaught SpotifyWebAPI\SpotifyWebAPIAuthException: code must be supplied in #121
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#121
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 @MarcelloDM on GitHub (Feb 20, 2020).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/184
I don't know if it can be useful for someone but after set my Authorization Code Flow I'm having this error:
PHP Fatal error: Uncaught SpotifyWebAPI\SpotifyWebAPIAuthException: code must be supplied in {$INSTALL_PATH}\vendor\jwilsson\spotify-web-api-php\src\Request.php:54Commenting the line
header('Location: app.php');incallback.phpI noticed that thecodevariable was not gettable by the variabile$_GET['code']. Infact it always was returned asNULLvalue and the$_GETas an empty array. So, in thecallback.php, I changed the parameter of that call from:$session->requestAccessToken($_GET['code'])to that with the 'superglobal'
$_REQUESTvariable:$session->requestAccessToken($_REQUEST['code'])In this way, the code was being not NULL anymore and the access token was properly generated.
After that you can save $accessToken in a session variabile i.e.
$_SESSION['accessToken'] = $accessToken;to make the access token visible to app.php.@jwilsson commented on GitHub (Feb 21, 2020):
Hey!
That's really strange that the
$_GETarray was empty. I'm glad you got it working with$_REQUESTthough and shared it here.I'm going to close this issue since it's not anything wrong with the library but thanks again for sharing it here!