mirror of
https://github.com/jwilsson/spotify-web-api-php.git
synced 2026-04-27 07:55:49 +03:00
[GH-ISSUE #91] issue using AJAX to follow playlist #46
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#46
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 @Pau1fitz on GitHub (Jun 14, 2017).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/91
I am trying to follow a playlist on spotify using this AJAX. I am implementing this functionality in a wordpress site.
I have the id of the playlist and the playlist owner name in my
index.phpfile. I then send this data tohttp://www.url/follow-playlist(which isfollowplaylist.phpin wordpress) and store the data as a session variable and do the authentication.I then use these session values in
index.phpbut I am seeing the following error.Below is the html in the
index.phpThe
follow-playlist.phpfile which translates tohttp://www.url/follow-playlistin wordpress looks as follows:My
index.phpfile includes the following code.The
divis just an example of one playlist. The page contains many of theseIs there another way you can think of to enable me to follow a playlist dynamically when a user clicks on a link on the front end, if AJAX is not an option?
@Pau1fitz commented on GitHub (Jun 15, 2017):
I managed to solve this by using cookies. If the user makes a POST request to the
follow-playlistendpoint then I store theplaylist-ownerandplaylist-idin cookies. Once the endpoint responds successfully I then navigate to thefollow-playlistendpoint and do the authentication as normal. The user is then sent back to the index page once he has authorised the app. Here I request the access token using the code from Spotify. I then use the cookie values to follow the intended playlist.