createAuthUrl(); header('Location: ' . filter_var($authUrl, FILTER_SANITIZE_URL)); exit; } elseif (isset($_GET['code'])) { $token = $client->fetchAccessTokenWithAuthCode($_GET['code']); $_SESSION['access_token'] = $token; header('Location: index.php'); exit; } $client->setAccessToken($_SESSION['access_token']); $tracks = listMP3Files($client); ?>