SpotifyDefaultCredentialStore

@RequiresApi(value = 23)
class SpotifyDefaultCredentialStore(clientId: String, redirectUri: String, applicationContext: Context)(source)

Provided credential store for holding current Spotify token credentials, allowing you to easily store and retrieve Spotify tokens. Recommended in most use-cases.

Parameters

clientId

The client id associated with your application

applicationContext

The application context - you can obtain this by storing your application context statically (such as with a companion object)

Constructors

Link copied to clipboard
constructor(clientId: String, redirectUri: String, applicationContext: Context)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

Get/set the current Spotify PKCE code verifier.

Link copied to clipboard

The EncryptedSharedPreferences that this API saves to/retrieves from.

Link copied to clipboard

Get/set the Spotify access token (the access token string, not the wrapped Token).

Link copied to clipboard

Get/set the Spotify refresh token.

Link copied to clipboard

Get/set the Spotify scope string.

Link copied to clipboard

Get/set the Spotify Token obtained from spotifyToken. If the token has expired according to spotifyTokenExpiresAt, this will return null.

Link copied to clipboard

Get/set when the Spotify access token will expire, in milliseconds from UNIX epoch. This will be one hour from authentication.

Functions

Link copied to clipboard

Returns whether the Token stored in this Credential Store is refreshable (whether there is a refresh token associated with it).

Link copied to clipboard
fun clear(): Boolean

Clear the SharedPreferences instance corresponding to the Spotify credentials.

Link copied to clipboard

Create a new SpotifyClientApi instance using the spotifyToken stored using this credential store.

Link copied to clipboard

Create a new SpotifyImplicitGrantApi instance using the spotifyToken stored using this credential store.

Link copied to clipboard

Sets spotifyToken using SpotifyApi.token. This wraps around spotifyToken's setter.