Forum

After sacfolding auth with: php artisan make:auth

Than I am getting followinf error:

ErrorException in AuthManager.php line 294: Call to undefined method App\Extensions\CustomUserProvider::check() (View: ...my-api-project\resources\views\welcome.blade.php)

So, is it possible to use custom Auth with scafolded views?

After adding

public static function check()
{
    return true;
}

to CustomUserProvider I am getting follwoing error:

FatalThrowableError in AuthManager.php line 294: Call to undefined method App\Extensions\CustomUserProvider::authenticate()

Here is my CustomUserProvider:

<?php

namespace App\Extensions;

use Illuminate\Contracts\Auth\User as UserContract;
use Illuminate\Contracts\Auth\UserProvider as UserProviderInterface;
use \Illuminate\Contracts\Auth\Authenticatable;

class CustomUserProvider implements UserProviderInterface
{
    public function retrieveById($identifier)
    {
        // TODO: Implement retrieveById() method.
    }

    public function retrieveByToken($identifier, $token)
    {
        // TODO: Implement retrieveByToken() method.
    }

    public function updateRememberToken(Authenticatable $user, $token)
    {
        // TODO: Implement updateRememberToken() method.
    }

    public function retrieveByCredentials(array $credentials)
    {
        // TODO: Implement retrieveByCredentials() method.
    }

    public function validateCredentials(Authenticatable $user, array $credentials)
    {
        // TODO: Implement validateCredentials() method.
    }

    public static function check()
    {
        return true;
    }

}

and here CustomAuthProvider:

<?php

namespace App\Extensions;

use App\User;
use App\Extensions\CustomUserProvider;
use Illuminate\Support\ServiceProvider;

class CustomAuthProvider extends ServiceProvider
{

    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        $this->app['auth']->extend('custom',function()
        {
            return new CustomUserProvider(new User);
        });
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }


}

I changed my AUTH_DRIVER=custom. I wrote the custom files like CustomUserProvider and CustomAuthProvider.

MY problem is that the user is not logged in after a true returns from the validateCredentials method.

WHY?