Now playing
Finish the Spotify sign-in
POST
/api/nowplaying/spotify/codeAdmin. Needs an unlock token (
x-tempolight-token) while a PIN lock is set; without a lock, anyone can call it.For signing in from another device: paste the address Spotify sent the browser to (or its code and state).
Request body application/json
urlstringThe address Spotify sent the browser to.
codestringstatestringResponses
200OKapplication/json
enabledbooleansupportedbooleanplatformstringstatestringOne of
"ok" "starting" "unavailable" "error" "off"messagestring | nullmethodstring | nullOne of
"osascript" "playerctl" "dbus-send" "powershell" nulltrackobject | null{source, app, device, title, artist, album, dur, pos, playing, posKnown, remembered, following}.
spotifyobject400The body isn't valid JSON, or a value is wrong.application/json
errorstringrequiredWhat went wrong, in a sentence for people.
403Locked, or not allowed.application/json
errorstringrequiredWhat went wrong, in a sentence for people.
Request
curl -X POST 'http://localhost:8080/api/nowplaying/spotify/code' \
-H 'content-type: application/json' \
-d '{
"url": "http://127.0.0.1:8080/api/nowplaying/spotify/callback?code=AQB…&state=x1y2"
}'const res = await fetch("http://localhost:8080/api/nowplaying/spotify/code", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"url": "http://127.0.0.1:8080/api/nowplaying/spotify/callback?code=AQB…&state=x1y2"
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"http://localhost:8080/api/nowplaying/spotify/code",
json={
"url": "http://127.0.0.1:8080/api/nowplaying/spotify/callback?code=AQB…&state=x1y2"
},
)
print(res.json())Response
{
"enabled": true,
"supported": true,
"platform": "darwin",
"state": "ok",
"message": null,
"method": "osascript",
"track": null,
"spotify": {
"clientId": "",
"connected": false,
"error": null,
"redirectUri": "http://127.0.0.1:8080/api/nowplaying/spotify/callback"
}
}{
"error": "Paste the whole address from the browser's address bar"
}{
"error": "Settings are locked. Unlock with the PIN in Settings."
}