Field Manual PHP / Laravel reference
← Security

Authentication

Secure authentication verifies credentials and manages sessions safely.

What it is

Secure authentication verifies credentials and manages sessions safely.

When to use it

Use framework authentication with throttling and generic failure messages.

Syntax

Hash::check($password, $user->password);

Example

// Bad: compare stored plaintext password.
// Good: Auth::attempt($credentials) with password hashes.
// After success:
$request->session()->regenerate();
// Protect login with throttle middleware.

Common mistakes

Never email/log plaintext passwords; consider MFA based on risk; distinguish recovery from normal login.

Related topics

AuthenticationAuthentication