SpotifyDefaultCredentialStore

class SpotifyDefaultCredentialStore(clientId: String, redirectUri: String, applicationContext: Context)

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

SpotifyDefaultCredentialStore
Link copied to clipboard
fun SpotifyDefaultCredentialStore(clientId: String, redirectUri: String, applicationContext: Context)
The client id associated with your application

Types

Companion
Link copied to clipboard
object Companion

Functions

canApiBeRefreshed
Link copied to clipboard
fun canApiBeRefreshed(): Boolean
Returns whether the Token stored in this Credential Store is refreshable (whether there is a refresh token associated with it).
clear
Link copied to clipboard
fun clear(): Boolean
Clear the SharedPreferences instance corresponding to the Spotify credentials.
equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
getSpotifyClientPkceApi
Link copied to clipboard
fun getSpotifyClientPkceApi(block: SpotifyApiOptions.() -> Unit? = null): SpotifyClientApi?
Create a new SpotifyClientApi instance using the spotifyToken stored using this credential store.
getSpotifyImplicitGrantApi
Link copied to clipboard
fun getSpotifyImplicitGrantApi(block: SpotifyApiOptions.() -> Unit? = null): SpotifyImplicitGrantApi?
Create a new SpotifyImplicitGrantApi instance using the spotifyToken stored using this credential store.
hashCode
Link copied to clipboard
open fun hashCode(): Int
setSpotifyApi
Link copied to clipboard
fun setSpotifyApi(api: GenericSpotifyApi)
toString
Link copied to clipboard
open fun toString(): String

Properties

credentialTypeStored
Link copied to clipboard
var credentialTypeStored: CredentialType? = null
encryptedPreferences
Link copied to clipboard
val encryptedPreferences: SharedPreferences
The EncryptedSharedPreferences that this API saves to/retrieves from.
spotifyAccessToken
Link copied to clipboard
var spotifyAccessToken: String?
Get/set the Spotify access token (the access token string, not the wrapped Token).
spotifyRefreshToken
Link copied to clipboard
var spotifyRefreshToken: String?
Get/set the Spotify refresh token.
spotifyToken
Link copied to clipboard
var spotifyToken: Token?
Get/set the Spotify Token obtained from spotifyToken.
spotifyTokenExpiresAt
Link copied to clipboard
var spotifyTokenExpiresAt: Long?
Get/set when the Spotify access token will expire, in milliseconds from UNIX epoch.

Sources

(source)
Link copied to clipboard