That's the purpose of having a hashed password, only the user should know their password.
If the user needs something from the api, setup a method to let the user get that information as needed. Just my opinion.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Is there a way to programmatically get the request that triggered an event? I'm listening for when a user is logged in and a new session is created. In my listener, I need to make a call to another api in order to fetch some data needed to update the user entry in the current app. Trouble is I need the password entered in the form but the password is hashed already (in the DB and Auth::user()->getAuthPassword() will return the hashed password) and I currently cant find a way to get the plain text password. The handle method in the listener is handed a Illuminate\Auth\Events\Login instance. Is it possible to get the request that fired the event and that way I can retrieve the request parameters for the purpose I need it for? Suggestions is highly appreciated.
EventServiceProvider
protected $listen = [
...
Login::class => [
GetFreshTokenFromApi::class
]
];
GetFreshTokenFromApi->handle
$fresh_token = ApiService::loginUser([
'email' => Auth::user()->email,
'password' => $request->get('password')
]);
That's the purpose of having a hashed password, only the user should know their password.
If the user needs something from the api, setup a method to let the user get that information as needed. Just my opinion.
Please or to participate in this conversation.