Cmd/Ctrl + K

Authentication

Annabel registers authentication services when the auth provider is enabled.

Configuration

Auth settings live in config/auth.php.

Important options:

OptionPurpose
providerProvider name, or null for a custom binding.
credential_keyCredential field for attempt(); defaults to email.
database.tableUser table for the database provider.
database.identifier_columnUser identifier column.
database.password_columnPassword hash column.
session_keySession key used to store the authenticated user id.
redirect_toRedirect target for unauthenticated web requests.

Login

Attempt authentication with the credential fields configured for the active provider.

Current user

Read the authenticated user through the auth service or convenience helper.

Check the guard explicitly:

Middleware

Apply auth middleware to routes that require an authenticated session.

Production applications should bind a database-backed user provider.

Logout

End the authenticated session when the user signs out.

By default logout invalidates the session.