Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Spotify Web Api Php Laravel Package

jwilsson/spotify-web-api-php

View on GitHub
Deep Wiki
Context7

Working with Scopes

All operations involving a user or their information requires your app to request one or more scopes. You request scopes at the same time as the access token, for example:

require 'vendor/autoload.php';

$session = new SpotifyWebAPI\Session(
    'CLIENT_ID',
    'CLIENT_SECRET',
    'REDIRECT_URI'
);

$options = [
    'scope' => [
        'user-library-modify',
        'user-read-birthdate',
    ],
];

header('Location: ' . $session->getAuthorizeUrl($options));
die();

It's possible to request more scopes at any time, simply add new ones to the list. This will ask the user to approve your app again.

Please refer to the Spotify docs for a full list of all available scopes.

Checking Requested Scopes

If you wish to check which scopes are granted for an access token, the Session::getScope() method can be used. For example, put the following code in your callback where the user will be redirected to by Spotify:

$accessToken = $session->requestAccessToken($_GET['code']);
$scopes = $session->getScope();

The same method can also be used after refreshing an access token, for example:

$session->refreshAccessToken($refreshToken);

$scopes = $session->getScope();
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo
stevenay/myanfont
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin