To use the Spotify connector, before calling any Spotify operation please add the <spotify.init> element in all configurations and <spotify.getAccessTokenFromRefreshToken> element in configurations that require user authorization.
Click Spotify operations for more details about Spotify resources.
Spotify connector uses Authorization Code Flow.
Note
To access user-related data such as playlists and musics saved in user library through the Web API, application must get the user’s authorization to access those data. So all User library and User playlist methods require application registration and user authorization.
You can follow the following steps to import your Spotify certificate into wso2esb client’s keystore as follows:
Go to https://developer.spotify.com / in your browser, and then click the HTTPS trust icon on the address bar (e.g., the padlock next to the URL in Firefox).
View the certificate details (the steps vary by browser) and then export the trust certificate to the file system.
Use the ESB Management Console or the following command to import that certificate into the ESB client keystore.
keytool -importcert -file CERT_FILE_NAME -keystore <ESB_HOME>/repository/resources/security/client-truststore.jks -alias "CERT_NAME"
NOTE : CERT_FILE_NAME - Replace CERT_FILE_NAME with the file name that was extracted from spotify with the extension. (e.g. spotify.crt)
CERT_NAME - Replace CERT_NAME with an arbitrary name for the certificate. (e.g. spotify)
Restart the server and deploy the Spotify configuration.
<spotify.init/>
<spotify.getAccessTokenFromRefreshToken> <clientId>f043fec58a584539ba94c0c588136712</clientId> <clientSecret>b421eecdfe184be29b1d297505befcac</clientSecret> <grantType>refresh_token</grantType> <refreshToken>AQCQPj6__vnciBWMpS1lJ_V_oefCZUy2V7z_Ha7WBoZZTKRsVPgDTtecOMN5rxXs9mvtencluvX3m_RNCsTqTTJtwZCmcrte_1Ar_SzXDug-AtdbSiZXMObPa8Kw0-8tE8c</refreshToken> </spotify.getAccessTokenFromRefreshToken>
Properties
clientId
: Value of the API Key given when you registered your application with Spotify API.clientSecret
: Client secret of Spotify API.grantType
: Token grant type. Value must be set to authorization_code.refreshToken
: Refresh token to get access token.
Now you have connected to Spotify, use the information in the following resources to perform the operations with the connector. After you have completed the configurations, go through Testing the Spotify Integration to test those operations.