PHP code example of pouler / spotify-login

1. Go to this page and download the library: Download pouler/spotify-login library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pouler / spotify-login example snippets


 declare(strict_types=1);

ponent\HttpClient\CurlHttpClient();
$client = new \PouleR\SpotifyLogin\SpotifyLoginClient($httpClient);
$spotifyLogin = new \PouleR\SpotifyLogin\SpotifyLogin($client);

$spotifyLogin->setClientId('clientId');
$spotifyLogin->setDeviceId('deviceId');

// Log in and get the access token
$token = $spotifyLogin->login('[email protected]','password');

// Refresh token
$newToken = $spotifyLogin->refreshToken($token->getUsername(), $token->getRefreshToken());

print_r($newToken);