Prerequisites
Make sure you have the following before proceeding:
- A valid Spotify account. Sign up at Spotify.com if you don’t have an account. This can be a personal or separate account you want to use for developer access and work.
- A valid Ad Studio account. Set up an Ad Studio Account if you don’t have one.
Steps to Create Spotify Developer Account
- Follow the Link Spotify For Developer and click Create a Spotify Developer Account
- Click on Sign up for Spotify Account
- Pop-up will Appear and Click on SIGN UP FOR SPOTIFY
- Fill the Required Filed and Click Sign up
- Tick the box and click on ACCEPT THE TERMS
Steps to Create App in Spotify
- After Login Dashboard look like this
- Click on CREATE AN APP
- Fill in the Details, Tick the box and click on CREATE
How to add Redirect URI (Mandatory Step)
- Dashboard Look Like This After App Creation
- Click on App Created
- Go to Edit Settings
- Enter Your Website URL and click the Add Button
- Go to the bottom of the page and click SAVE
Note: For Completion of Further Steps the URI is Needed
How to Find Client ID and Client Secret
- Go to the Dashboard
- Select the App
- Click on SHOW CLIENT SECRET
- Copy the Client ID and Client Secret
Note: Client id and Client Secret are needed to complete Further Step
Authenticate your Ad Studio account
- Copy the authentication URL shown below into the address field of your browser.
- client_id with your real client ID.
- callback_placeholder (after redirect_uri=) with your callback URL.
Example:
https://accounts.spotify.com/authorize/?client_id=db405514beccXXXXXXXX08aec0ccef&response_type=code&redirect_uri=https://sprighub.ai/
- Log in to your Spotify account and authorize your application.
- Enter the URL From Step 1 in Browser Tab Like This and Press Enter
- Check the browser address bar for the parameter code=XXXXXXXX
Example:
Note: The access code is valid for 10 minutes. Save the code for Step 6
- Open a terminal window and run the command shown below. In this command, replace client_id and client_secret with your real client ID and secret. Save the output for Step 6.
echo -n [client_id]:[client_secret] | base64
Get the Client id and Client Secret From here
Example: Encode the String in base64
echo -n db405514becc4a028fc6f008aec0ccef:c1d7cdb2fb7644c0b142e179f315e1a4 | base64
Copy the output
- Run the command shown below to generate an access token. A valid token is required to make API requests
curl –location –request POST ‘https://accounts.spotify.com/api/token’ \
–header ‘Authorization: Basic BASE64_OUTPUT_FROM_STEP_5’ \
–header ‘Content-Type: application/x-www-form-urlencoded’ \
–data-urlencode ‘code= CODE_FROM_STEP_4’ \
–data-urlencode ‘redirect_uri=https://sprighub.ai/’ \
–data-urlencode ‘grant_type=authorization_code’
In this command, replace:
- CODE_FROM_STEP_4 with the code from Step 4.
- BASE64_OUTPUT_FROM_STEP_5 with the code from Step 5.
Example:
curl –location –request POST ‘https://accounts.spotify.com/api/token’ \
–header ‘Authorization: Basic ZGI0MDU1MTRiZWNGNjZxxxxxxxxxxxxxxxUxYTQ=’ \
–header ‘Content-Type: application/x-www-form-urlencoded’ \
–data-urlencode ‘code=AQCQ1vc2frQMVPwu2GIUUHXsOcZpng1VAeD7MH7
XXXXXXXXXXXXXXXXXXXXXXXGtV8Eu2HW’ \
–data-urlencode ‘redirect_uri=https://sprighub.ai/’ \
–data-urlencode ‘grant_type=authorization_code’
Response: We will Get a Refresh Token and Access Token in Response
*** Refresh Token is the required Attribute for the ETL Team ***
Leave a Reply