Closed pavelkomarov closed 2 months ago
Apparently you can't simply GET unless your plan is to go to that website, due to cross-origin request limitations.
Okay, I toyed with simply opening the Spotify login dialog each time from the login button, but I really want to do more than simulate a Spotify logout, and I would like to not make the user sign in if they happen to already be signed in to the web app in their browser or just navigated away for a bit. So that means true logout behavior, and the only way to get that is to actually direct to the logout page. Since I can't do an iframe, and I can't do a fetch()
, and I have no control over a redirect if I send the current window to the logout page because Spotify doesn't seem to offer that, that leaves sending a different window to the logout page. I can then close that window and redirect the Exportify window to the home page, which reloads index.html
, which has empty content, thus nixing the playlists table.
Implemented with https://github.com/pavelkomarov/exportify/commit/3a0fb9e56e05476c6001b7edbbe6424d94a7ed1b
Clicking log out returns you to the home screen, but if you click log in again, it goes and fetches your data again, doesn't give the opportunity for someone else to log in.
I believe Spotify isn't allowing their website to be embedded in a iframe. If I navigate to the logout address, then I'm logged out and get the login dialog next round. But no matter how long the delay I set to let my iframe's request go through, the user isn't logged out.
Perhaps an invisible GET request to the logout address is sufficient?