This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Configuring Spotify Operations
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 do the following steps to import your Spotify certificate into wso2esb client’s keystore:
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)
- ESB should be configured as below.
Ensure that the following Axis2 configurations are added and enabled in the
<ESB_HOME>\repository\conf\axis2\axis2.xml
file.Required message formatters
messageFormatters<messageFormatter contentType="text/html" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/> <messageFormatter contentType="text/plain" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
Required message builders
messageBuilders<messageBuilder contentType="text/html" class="org.wso2.carbon.relay.BinaryRelayBuilder"/> <messageBuilder contentType="text/plain" class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
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.