How to store password in angularjs securely How to store password in angularjs securely angularjs angularjs

How to store password in angularjs securely


You cannot prevent that someone reads the username and password from the memory, but you could spend some effort on what is send to the server.

You should try to hash the password and username when sending them to the server. Use a salt that is unique to the users session, so it is more unpredictable and requires a full record of the whole traffic.

This will not result in absolute security, but raise the bar for some one else to read everything.

P.S.: I would strongly recommend to use SSL.


I think you need to define what you mean by "securely". In particular, define exactly what it is you are trying to defend against and why you aren't protecting against the common attack vectors.

If you are purely trying to protect the physical device against memory reads, then you're out of luck as NOTHING can do that. Yes, there are ways to make it more difficult, but ultimately if they have physical access to the device then nothing you can do will prevent loss.

If you are talking about man in the middle or similar style attacks then by ignoring the best tool in your kit (SSL certs) you have already lost.

The only sites that work by caching and constantly resubmitting the user/pw are ones built by those who have no idea what they are doing because it is a very bad practice.