[GH-ISSUE #196] Fatal error #133

Closed
opened 2026-02-27 19:26:14 +03:00 by kerem · 2 comments
Owner

Originally created by @shon-011 on GitHub (Jun 21, 2020).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/196

H!
I would like to use spotify-web-api-php to search for music.
However, during the authentication process I am encountering the following error.

Fatal error: Uncaught SpotifyWebAPI\SpotifyWebAPIAuthException: Invalid client in /Applications/MAMP/htdocs/php_k/vendor/jwilsson/spotify-web-api-php/src/Request.php:65 Stack trace: #0 /Applications/MAMP/htdocs/php_k/vendor/jwilsson/spotify-web-api-php/src/Request.php(265): SpotifyWebAPI\Request->parseBody(Object(stdClass), 400) #1 /Applications/MAMP/htdocs/php_k/vendor/jwilsson/spotify-web-api-php/src/Request.php(115): SpotifyWebAPI\Request->send('POST', 'https://account...', 'grant_type=clie...', Array) #2 /Applications/MAMP/htdocs/php_k/vendor/jwilsson/spotify-web-api-php/src/Session.php(186): SpotifyWebAPI\Request->account('POST', '/api/token', Array, Array) #3 /Applications/MAMP/htdocs/php_k/test.php(13): SpotifyWebAPI\Session->requestCredentialsToken() #4 {main} thrown in /Applications/MAMP/htdocs/php_k/vendor/jwilsson/spotify-web-api-php/src/Request.php on line 65

`<?php
ini_set( 'display_errors', 1 );
ini_set( 'error_reporting', E_ALL );

require_once('vendor/autoload.php');
$session = new SpotifyWebAPI\Session(
    '{CLIENT_ID}',
    '{CLIENT_SECRET}'
);
$api = new SpotifyWebAPI\SpotifyWebAPI();
$session->requestCredentialsToken();
$accessToken = $session->getAccessToken();
$api->setAccessToken($accessToken);

$result = $api->search('Retrovision', 'artist');

?>

    
`

Please help me.

Originally created by @shon-011 on GitHub (Jun 21, 2020). Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/196 H! I would like to use spotify-web-api-php to search for music. However, during the authentication process I am encountering the following error. > Fatal error: Uncaught SpotifyWebAPI\SpotifyWebAPIAuthException: Invalid client in /Applications/MAMP/htdocs/php_k/vendor/jwilsson/spotify-web-api-php/src/Request.php:65 Stack trace: #0 /Applications/MAMP/htdocs/php_k/vendor/jwilsson/spotify-web-api-php/src/Request.php(265): SpotifyWebAPI\Request->parseBody(Object(stdClass), 400) #1 /Applications/MAMP/htdocs/php_k/vendor/jwilsson/spotify-web-api-php/src/Request.php(115): SpotifyWebAPI\Request->send('POST', 'https://account...', 'grant_type=clie...', Array) #2 /Applications/MAMP/htdocs/php_k/vendor/jwilsson/spotify-web-api-php/src/Session.php(186): SpotifyWebAPI\Request->account('POST', '/api/token', Array, Array) #3 /Applications/MAMP/htdocs/php_k/test.php(13): SpotifyWebAPI\Session->requestCredentialsToken() #4 {main} thrown in /Applications/MAMP/htdocs/php_k/vendor/jwilsson/spotify-web-api-php/src/Request.php on line 65 `<?php ini_set( 'display_errors', 1 ); ini_set( 'error_reporting', E_ALL ); require_once('vendor/autoload.php'); $session = new SpotifyWebAPI\Session( '{CLIENT_ID}', '{CLIENT_SECRET}' ); $api = new SpotifyWebAPI\SpotifyWebAPI(); $session->requestCredentialsToken(); $accessToken = $session->getAccessToken(); $api->setAccessToken($accessToken); $result = $api->search('Retrovision', 'artist'); ?> <pre> <?php print_r($result) ?> </pre>` Please help me.
kerem 2026-02-27 19:26:14 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@jwilsson commented on GitHub (Jun 21, 2020):

Hey!
It seems the client ID or client secret is wrong since you're getting "Invalid client" back from Spotify. I'd double check the client ID and secret or try creating a new app and use those values instead.

<!-- gh-comment-id:647168490 --> @jwilsson commented on GitHub (Jun 21, 2020): Hey! It seems the client ID or client secret is wrong since you're getting "Invalid client" back from Spotify. I'd double check the client ID and secret or try creating a new app and use those values instead.
Author
Owner

@shon-011 commented on GitHub (Jun 21, 2020):

Thanks for the reply!

I just did and I've done it!
Apparently, I made a mistake in assigning the Client ID and Client Secret with { }.

Thanks so much!

<!-- gh-comment-id:647190658 --> @shon-011 commented on GitHub (Jun 21, 2020): Thanks for the reply! I just did and I've done it! Apparently, I made a mistake in assigning the Client ID and Client Secret with { }. Thanks so much!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-web-api-php#133
No description provided.