Skip to content
Advertisement

How Can I Get False in Auth::attempts Laravel

I Have AuthController, with this code

JavaScript

and i Hash with my Own Hash, and when i dump the $credentials, the value is correct.

but when i dump Auth::attempt($credentials) i got false result.

Advertisement

Answer

Using your own hash function for authentication isn’t as straight forward as implementing a custom hash function and dropping it in place.

The entire process is more involved.

First, you need to create a Hasher class that implements IlluminateContractsHashingHasher interface.

JavaScript

Then implement a custom HashManager that includes a factory for the CustomHash driver.

JavaScript

Then implement a ServiceProvider to use your custom HashManager for driving custom hashing functionality.

JavaScript

Then register AppHashingCustomHashServiceProvider::class in place of IlluminateHashingHashServiceProvider::class in config/app.php

Finally in config/hashing.php, configure your application to use the custom driver.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement