[GH-ISSUE #86] Using this api on headless server #43

Closed
opened 2026-02-27 19:25:45 +03:00 by kerem · 1 comment
Owner

Originally created by @TwanoO67 on GitHub (Jun 7, 2017).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/86

Hello guys,

I would like to use this API in a script from a headless server.
The final goal that I'm trying to achieve is, having a button in my livingroom where i can press, to show the last played spotify track, and double press to add it to my savings.

So I have my buttons, which call an url on my server, with parameters like ?get_track or ?add_track in the url.
Pointing to this script: https://github.com/TwanoO67/spotify-add-current/blob/master/src/index.php

The problem is, this API seems to be only accessible with an oauth connexion.
So my script is working if I executed threw a browser, but not if I call it with a headless device.

I tried to get the acces token once and then always refreshing it, but it doesn't seems to be persistent neither.
Is there another way to access my account data without the oauth session?
Does some of you have an idea on how i could achieve that ?

Any idea will be much appreciated :)

Originally created by @TwanoO67 on GitHub (Jun 7, 2017). Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/86 Hello guys, I would like to use this API in a script from a headless server. The final goal that I'm trying to achieve is, having a button in my livingroom where i can press, to show the last played spotify track, and double press to add it to my savings. So I have my buttons, which call an url on my server, with parameters like ?get_track or ?add_track in the url. Pointing to this script: https://github.com/TwanoO67/spotify-add-current/blob/master/src/index.php The problem is, this API seems to be only accessible with an oauth connexion. So my script is working if I executed threw a browser, but not if I call it with a headless device. I tried to get the acces token once and then always refreshing it, but it doesn't seems to be persistent neither. Is there another way to access my account data without the oauth session? Does some of you have an idea on how i could achieve that ? Any idea will be much appreciated :)
kerem 2026-02-27 19:25:45 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@jwilsson commented on GitHub (Jun 9, 2017):

Hi!
I'm afraid that accessing a user account will always require some user interaction. Your approach with requesting an access token and then refreshing it should work, but as you said, I don't know for how long that's possible.

I'll leave this open in case anyone else has any idea though. I'd try asking on Stack Overflow or something too.

Good luck!

<!-- gh-comment-id:307302283 --> @jwilsson commented on GitHub (Jun 9, 2017): Hi! I'm afraid that accessing a user account will always require some user interaction. Your approach with requesting an access token and then refreshing it should work, but as you said, I don't know for how long that's possible. I'll leave this open in case anyone else has any idea though. I'd try asking on Stack Overflow or something too. Good luck!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-web-api-php#43
No description provided.