Skip to content
Advertisement

(Spotify) how to stop cross browser session sharing?

I’m using the spotify api and for some reason their session class blocks to store own data in $_SESSION. As a workaround I wrote a class ‘SystemHelper’:

namespace App;

JavaScript

It is possible now to store data in $_SESSION but the problem is that as long as I’m logged in with my account (own login form, not spotfiy account), everybody else is logged in, no matter which browser, ip, etc…

I don’t know how this can be solved. Shouldn’t session_id generate a random id? Anybody can help please?

Leaving out

JavaScript

doesn’t solve it because I need to read and delete the data stored in session as well. So, additionally I have in this workaround:

JavaScript

and…

JavaScript

Advertisement

Answer

Solved, actually pretty simple. The problem first: If written like this:

JavaScript

in both, customStore and customRead simply means resuming the session. Of course you will always get the same data, no matter which browser, ip, … that’s the point of resuming the session.

What is solved:

JavaScript

So, the full again:

JavaScript

and,

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement