pub struct AuthCodePkceSpotify {
    pub creds: Credentials,
    pub oauth: OAuth,
    pub config: Config,
    pub token: Arc<Mutex<Option<Token>>>,
    pub verifier: Option<String>,
    /* private fields */
}
Expand description

The Authorization Code Flow with Proof Key for Code Exchange (PKCE) client for the Spotify API.

This flow is very similar to the regular Authorization Code Flow, so please read AuthCodeSpotify for more information about it. The main difference in this case is that you can avoid storing your client secret by generating a code verifier and a code challenge. However, note that the refresh token obtained with PKCE will only work to request the next one, after which it’ll become invalid.

There’s an example available to learn how to use this client.

Fields

creds: Credentialsoauth: OAuthconfig: Configtoken: Arc<Mutex<Option<Token>>>verifier: Option<String>

The code verifier for the authentication process

Implementations

Builds a new AuthCodePkceSpotify given a pair of client credentials and OAuth information.

Build a new AuthCodePkceSpotify from an already generated token. Note that once the token expires this will fail to make requests, as the client credentials aren’t known.

Same as Self::new but with an extra parameter to configure the client.

Returns the URL needed to authorize the current client as the first step in the authorization flow.

The parameter verifier_bytes is the length of the randomly generated code verifier. Note that it must be between 43 and 128. If None is given, a length of 43 will be used by default. See the official docs or PKCE’s RFC for more information about the code verifier.

Trait Implementations

This client has access to the base methods.

Note that the token is wrapped by a Mutex in order to allow interior mutability. This is required so that the entire client doesn’t have to be mutable (the token is accessed to from every endpoint). Read more

Refetch the current access token given a refresh token.

If it’s a relative URL like “me”, the prefix is appended to it. Otherwise, the same URL is returned. Read more

Re-authenticate the client automatically if it’s configured to do so, which uses the refresh token to obtain a new access token. Read more

Refreshes the current access token given a refresh token. The obtained token will be saved internally. Read more

Updates the cache file at the internal cache path. Read more

Sends a request to Spotify for an access token.

Returns a single track given the track’s ID, URI or URL. Read more

Returns a list of tracks given a list of track IDs, URIs, or URLs. Read more

Returns a single artist given the artist’s ID, URI or URL. Read more

Returns a list of artists given the artist IDs, URIs, or URLs. Read more

Get Spotify catalog information about an artist’s albums. Read more

The manually paginated version of Self::artist_albums.

Get Spotify catalog information about an artist’s top 10 tracks by country. Read more

Get Spotify catalog information about artists similar to an identified artist. Similarity is based on analysis of the Spotify community’s listening history. Read more

Returns a single album given the album’s ID, URIs or URL. Read more

Returns a list of albums given the album IDs, URIs, or URLs. Read more

Search for an Item. Get Spotify catalog information about artists, albums, tracks or playlists that match a keyword string. Read more

Get Spotify catalog information about an album’s tracks. Read more

The manually paginated version of Self::album_track.

Gets basic profile information about a Spotify User. Read more

Get full details about Spotify playlist. Read more

Gets playlist of a user. Read more

Check to see if the given users are following the given playlist. Read more

Get Spotify catalog information for a single show identified by its unique Spotify ID. Read more

Get Spotify catalog information for multiple shows based on their Spotify IDs. Read more

Get Spotify catalog information about an show’s episodes. Optional parameters can be used to limit the number of episodes returned. Read more

The manually paginated version of Self::get_shows_episodes.

Get Spotify catalog information for a single episode identified by its unique Spotify ID. Read more

Get Spotify catalog information for multiple episodes based on their Spotify IDs. Read more

Get audio features for a track Read more

Get Audio Features for Several Tracks Read more

Get Audio Analysis for a Track Read more

Get a list of new album releases featured in Spotify Read more

The manually paginated version of Self::categories.

Get a list of playlists in a category in Spotify Read more

The manually paginated version of Self::category_playlists.

Get a list of Spotify featured playlists. Read more

Get a list of new album releases featured in Spotify. Read more

The manually paginated version of Self::new_releases.

Get Recommendations Based on Seeds Read more

Get full details of the items of a playlist owned by a user. Read more

The manually paginated version of Self::playlist_items.

Gets playlists of a user. Read more

The manually paginated version of Self::user_playlists.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This client includes user authorization, so it has access to the user private endpoints in OAuthClient.

Note that the code verifier must be set at this point, either manually or with Self::get_authorize_url. Otherwise, this function will panic.

Tries to read the cache file’s token. Read more

Parse the response code in the given response url. If the URL cannot be parsed or the code parameter is not present, this will return None. Read more

Tries to open the authorization URL in the user’s browser, and returns the obtained code. Read more

Opens up the authorization URL in the user’s browser so that it can authenticate. It reads from the standard input the redirect URI in order to obtain the access token information. The resulting access token will be saved internally once the operation is successful. Read more

Get current user playlists without required getting his profile. Read more

The manually paginated version of Self::current_user_playlists.

Creates a playlist for a user. Read more

Changes a playlist’s name and/or public/private state. Read more

Unfollows (deletes) a playlist for a user. Read more

Adds items to a playlist. Read more

Replace all items in a playlist Read more

Reorder items in a playlist. Read more

Removes all occurrences of the given items from the given playlist. Read more

Removes specfic occurrences of the given items from the given playlist. Read more

Add the current authenticated user as a follower of a playlist. Read more

Get detailed profile information about the current user. An alias for the ‘current_user’ method. Read more

Get detailed profile information about the current user. An alias for the ‘me’ method. Read more

Get information about the current users currently playing item. Read more

Gets a list of the albums saved in the current authorized user’s “Your Music” library Read more

The manually paginated version of Self::current_user_saved_albums.

Get a list of the songs saved in the current Spotify user’s “Your Music” library. Read more

The manually paginated version of Self::current_user_saved_tracks.

Gets a list of the artists followed by the current authorized user. Read more

Remove one or more tracks from the current user’s “Your Music” library. Read more

Check if one or more tracks is already saved in the current Spotify user’s “Your Music” library. Read more

Save one or more tracks to the current user’s “Your Music” library. Read more

Get the current user’s top artists. Read more

The manually paginated version of Self::current_user_top_artists.

Get the current user’s top tracks. Read more

The manually paginated version of Self::current_user_top_tracks.

Get the current user’s recently played tracks. Read more

Add one or more albums to the current user’s “Your Music” library. Read more

Remove one or more albums from the current user’s “Your Music” library. Read more

Check if one or more albums is already saved in the current Spotify user’s “Your Music” library. Read more

Follow one or more artists. Read more

Unfollow one or more artists. Read more

Check to see if the current user is following one or more artists or other Spotify users. Read more

Follow one or more users. Read more

Unfollow one or more users. Read more

Get a User’s Available Devices Read more

Get Information About The User’s Current Playback Read more

Get the User’s Currently Playing Track Read more

Transfer a User’s Playback. Read more

Start/Resume a User’s Playback. Read more

Start a user’s playback Read more

Pause a User’s Playback. Read more

Resume a User’s Playback. Read more

Skip User’s Playback To Next Track. Read more

Skip User’s Playback To Previous Track. Read more

Seek To Position In Currently Playing Track. Read more

Set Repeat Mode On User’s Playback. Read more

Set Volume For User’s Playback. Read more

Toggle Shuffle For User’s Playback. Read more

Add an item to the end of the user’s playback queue. Read more

Add a show or a list of shows to a user’s library. Read more

Get a list of shows saved in the current Spotify user’s library. Optional parameters can be used to limit the number of shows returned. Read more

The manually paginated version of Self::get_saved_show.

Check if one or more shows is already saved in the current Spotify user’s library. Read more

Delete one or more shows from current Spotify user’s library. Changes to a user’s saved shows may not be visible in other Spotify applications immediately. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.