mirror of
https://github.com/jwilsson/spotify-web-api-php.git
synced 2026-04-27 07:55:49 +03:00
[GH-ISSUE #86] Using this api on headless server #43
Labels
No labels
bug
docs
enhancement
enhancement
enhancement
feedback wanted
good first issue
help wanted
help wanted
help wanted
invalid
pull-request
question
question
upstream
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-web-api-php#43
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 :)
@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!