Log a failure without the password

Log the user id and the failure. Do not log the request body, the token, or the password.

For your AI agent

Copies a prompt. Paste it into the AI agent you already have open.

Read https://laravel-vuejs.space/laravel-log-stack-vue.md
Log the user id and the failure. Do not log the request body, the token, or the password.
Do not log the request body, the token, or the password.
Do not log the CSRF token, the session id, or Authorization.
Do not send log lines to the Inertia page so an admin can read them in Vue.
Show the diff. Do not commit.
On this page · 3 sections
  1. The fix
  2. What to avoid
  3. FAQ

People searching “Laravel log Vue error” write Log::debug($request->all()) in the login controller. The password lands in storage/logs. Log the fact, not the secret. The Fortify guide is the login. This page is the line you add when it fails.

TL;DR

  • Log the user id and the failure.
  • Do not log the request body, the token, or the password.
  • Do not log the CSRF token, the session id, or Authorization.
  • Do not send log lines to the Inertia page so an admin can read them in Vue.

Who it's for: Laravel + Vue developers

Applies to: Laravel 13 · Vue 3

The fix#

php
Log::warning('login failed', [
    'email' => $request->string('email')->toString(),
    'ip' => $request->ip(),
]);

LOG_STACK=daily rotates the file. single is one growing file. Neither choice makes a password acceptable.

A Vue onError can show “Could not sign in”. It should not console.log the form, for the same reason. The browser console is not private on a shared machine.

What to avoid#

Gotcha

Do not log the CSRF token, the session id, or Authorization. Do not send log lines to the Inertia page so an admin can read them in Vue. That is how a log viewer becomes a data leak. Telescope, local only, is the debugging tool.

FAQ#

How do I log a failure without the password?

Log the user id and the failure. Do not log the request body, the token, or the password.

What goes wrong with Laravel log Vue error?

Many developers write Log::debug($request->all()) in the login controller. Do not log the CSRF token, the session id, or Authorization.

Found this useful?

Ask questions, share what you built.

Join thousands of Laravel and Vue developers in our Facebook group, or get new posts in your Telegram feed. Sharing this article helps too.

Keep reading

Newsletter

Get the best of Laravel & Vue, once a month.

One short email with new guides, release notes worth reading and hand-picked community links. No spam, unsubscribe any time.