Site Tools


linux:ubuntu:spotify

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:ubuntu:spotify [2021/12/29 00:07] lunetikklinux:ubuntu:spotify [2023/01/18 16:10] (current) lunetikk
Line 7: Line 7:
 ===== Register an App ===== ===== Register an App =====
  
-[[https://developer.spotify.com/documentation/general/guides/app-settings/#register-your-app|Register App]]+[[https://developer.spotify.com/documentation/general/guides/authorization/app-settings/|Register App]]
  
 ===== Get your Secrets ===== ===== Get your Secrets =====
  
-Get your ClientID, ClientSecret and CallbackURL from the App+Get your ClientID, ClientSecret and CallbackURL from the registered App
  
 Create an Authcode, replace <YOURCLIENTID> and <YOURCALLBACKURL> with yours, you also might need to change the scope if you want to gather more info than just your current music. After opening the URL in your browser you will be redirected to an URL with your Code. Create an Authcode, replace <YOURCLIENTID> and <YOURCALLBACKURL> with yours, you also might need to change the scope if you want to gather more info than just your current music. After opening the URL in your browser you will be redirected to an URL with your Code.
Line 27: Line 27:
  
 <code> <code>
-<YOURCLIENTID>:<YOURCLIENTSECRET>+echo "<YOURCLIENTID>:<YOURCLIENTSECRET>" | base64
  
 Example: Example:
Line 34: Line 34:
 </code> </code>
  
-Now get your AccessToken via CLI+Now get your AccessToken and RefreshToken via CLI
  
 <code> <code>
Line 40: Line 40:
  
 Example: Example:
-curl -H "Authorization: Basic <YOURBASE64CODE>" -d grant_type="authorization_code" -d code="<YOURAUTHCODE>" -d redirect_uri="http%3A%2F%2F<YOURCALLBACKURL>%2Fcallback%2F" https://accounts.spotify.com/api/token 
- 
 curl -H "Authorization: Basic TH1S1SS0D3C0D3DTH1S1SS0D3C0D3DTH1S1SS0D3C0D3DTH1S1SS0D3C0D3D" -d grant_type="authorization_code" -d code="AQCPtOSCKsPt..........YIcyfimgKFeejPg" -d redirect_uri="http%3A%2F%2Flocalhost:3000%2Fcallback%2F" https://accounts.spotify.com/api/token curl -H "Authorization: Basic TH1S1SS0D3C0D3DTH1S1SS0D3C0D3DTH1S1SS0D3C0D3DTH1S1SS0D3C0D3D" -d grant_type="authorization_code" -d code="AQCPtOSCKsPt..........YIcyfimgKFeejPg" -d redirect_uri="http%3A%2F%2Flocalhost:3000%2Fcallback%2F" https://accounts.spotify.com/api/token
  
 {"access_token":"BQCMW.........z8gNg","token_type":"Bearer","expires_in":3600,"refresh_token":"AQDn.........cXK_gU","scope":"user-read-currently-playing"} {"access_token":"BQCMW.........z8gNg","token_type":"Bearer","expires_in":3600,"refresh_token":"AQDn.........cXK_gU","scope":"user-read-currently-playing"}
 +</code>
 +
 +===== Renew your AccessToken =====
 +
 +If your AccessToken is expired, renew it with your RefreshToken
 +
 +<code>
 +curl -H "Authorization: Basic <YOURBASE64CODE>" -d grant_type="refresh_token" -d refresh_token="<YOURREFRESHTOKEN>" -d redirect_uri="http%3A%2F%2F<YOURCALLBACKURL>%2Fcallback%2F" https://accounts.spotify.com/api/token
 +
 +Example:
 +curl -H "Authorization: Basic TH1S1SS0D3C0D3DTH1S1SS0D3C0D3DTH1S1SS0D3C0D3DTH1S1SS0D3C0D3D" -d grant_type="refresh_token" -d refresh_token="AQDn.........cXK_gU" -d redirect_uri="http%3A%2F%2Flocalhost:3000%2Fcallback%2F" https://accounts.spotify.com/api/token
 +
 +{"access_token":"BQC2e.........LDSA","token_type":"Bearer","expires_in":3600,"scope":"user-read-currently-playing"}
 </code> </code>
  
 ===== Get your current music ===== ===== Get your current music =====
  
-You can get your music via the following CURL to check your token+You can get your music via the following CURL to check your AccessToken
  
 <code> <code>
linux/ubuntu/spotify.1640732821.txt.gz · Last modified: 2021/12/29 00:07 by lunetikk