๐—”๐˜‚๐˜๐—ต๐—ฒ๐—ป๐˜๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—Ÿ๐—ฒ๐˜€๐˜€๐—ผ๐—ป๐˜€ ๐—œ ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป๐—ฒ๐—ฑ ๐˜๐—ต๐—ฒ ๐—›๐—ฎ๐—ฟ๐—ฑ ๐—ช๐—ฎ๐˜†

I started my career with freedom. I tried PHP and Java. I lacked a mentor. I built a login system. It failed.

I used session variables first. This fails during scaling. Requests go to different servers. Users lose their sessions.

I used MD5 for passwords. MD5 is hashing. It is not encryption. Attackers use lists to find passwords. I also used HTTP. Data was sent in plain text.

I made a custom token system. It hit the database every request. It was slow. It did not scale.

Do not reinvent security. Use proven tools.

Use BCrypt for passwords. It uses a salt and a cost factor. This stops fast attacks. Add a pepper for more safety.

Use JWT for tokens. It is a signed token. Services verify the sign. They do not need the database. This is fast.

Use two tokens:

Security tips:

Security is not about being clever. Use proven solutions. Ask yourself:

Source: https://dev.to/jmnovelovargas/learnings-about-authentication-and-authorization-hjb