SpotifyWebAPI\Session::__construct(string $clientId, string $clientSecret, string $redirectUri, \SpotifyWebAPI\Request $request)
Constructor
Set up client credentials.
$clientIdstring - The client ID.$clientSecretstring - The client secret.$redirectUristring - Optional. The redirect URI.$request\SpotifyWebAPI\Request - Optional. The Request object to use.
string SpotifyWebAPI\Session::getAuthorizeUrl(array|object $options)
Get the authorization URL.
$optionsarray|object - Optional. Options for the authorization URL.- array scope Optional. Scope(s) to request from the user.
- boolean show_dialog Optional. Whether or not to force the user to always approve the app. Default is false.
- string state Optional. A CSRF token.
- string The authorization URL.
string SpotifyWebAPI\Session::getAccessToken()
Get the access token.
- string The access token.
string SpotifyWebAPI\Session::getClientId()
Get the client ID.
- string The client ID.
string SpotifyWebAPI\Session::getClientSecret()
Get the client secret.
- string The client secret.
integer SpotifyWebAPI\Session::getTokenExpiration()
Get the access token expiration time.
- integer A Unix timestamp indicating the token expiration time.
string SpotifyWebAPI\Session::getRedirectUri()
Get the client's redirect URI.
- string The redirect URI.
string SpotifyWebAPI\Session::getRefreshToken()
Get the refresh token.
- string The refresh token.
array SpotifyWebAPI\Session::getScope()
Get the scope for the current access token
- array The scope for the current access token
boolean SpotifyWebAPI\Session::refreshAccessToken(string $refreshToken)
Refresh an access token.
$refreshTokenstring - The refresh token to use.
- boolean Whether the access token was successfully refreshed.
boolean SpotifyWebAPI\Session::requestCredentialsToken()
Request an access token using the Client Credentials Flow.
- boolean True when an access token was successfully granted, false otherwise.
boolean SpotifyWebAPI\Session::requestAccessToken(string $authorizationCode)
Request an access token given an authorization code.
$authorizationCodestring - The authorization code from Spotify.
- boolean True when the access token was successfully granted, false otherwise.
void SpotifyWebAPI\Session::setClientId(string $clientId)
Set the client ID.
$clientIdstring - The client ID.
- void
void SpotifyWebAPI\Session::setClientSecret(string $clientSecret)
Set the client secret.
$clientSecretstring - The client secret.
- void
void SpotifyWebAPI\Session::setRedirectUri(string $redirectUri)
Set the client's redirect URI.
$redirectUristring - The redirect URI.
- void
void SpotifyWebAPI\Session::setRefreshToken(string $refreshToken)
Set the session's refresh token.
$refreshTokenstring - The refresh token.
- void