I have an socket.IO server. But everyone can use it at the moment. How can I prevent that? I want to use the server (as an api) with my own IOS app and nothing else. What is the best way to do this?
I was thinking about this:
Connect with the socket.io server and set status (in the user array) to auth false;
Sent a message as that user with an token, when the token is correct set status auth to true;
So I have an token at my server for example 123. And sent an token with my app wich is also 123. I check 123 == 123 and let the user in. But when I need to change the tokens if someone leaks it I have a big problem. Because it is static at the app.
Note that my users don't have an account or something like that. It is just the app and the server.
What is the best approach for this? At an early (php) project have made something with an secret and public key. Wich is solid in my ideas. Is something also possible?