Ad

Target [League\OAuth2\Server\Repositories\ClientRepositoryInterface] Is Not Instantiable While Building [League\OAuth2\Server\AuthorizationServer]

I've recently set up a new Laravel 5.5 project on Ubuntu 16.04 with an NGINX server. I've followed all the correct steps and double checked everything more than once. I've installed Laravel/Passport and double checked those set up instructions as well.

I'm building an API that requires a login for most endpoints, which is done via password_grant with laravel/passport but can also consumes a Facebook auth token - instead of writing my own Facebook Auth Token verify, I've chosen to use a larval plugin. composer require danjdewhurst/laravel-passport-facebook-login However, this plugin doesn't seem to install easily for me.

I am receiving an error on any composer install or update command I issue:

Target [League\OAuth2\Server\Repositories\ClientRepositoryInterface] is not instantiable while building [League\OAuth2\Server\AuthorizationServer].

I have played around with the config/app.php file as well as the uses for all of the files and providers that were installed with the plugin. I have gone through every post here to try and fix the issue as well.

If anyone has any insight or a fix for this issue I'd appreciate it. Any help would help.

Thank you.

Ad

Answer

I found this to be an issue with the order of Laravel's auto discovery of packages. Obviously the Facebook Grant package needs to load after laravel/passport but this was not happening.

My solution was to add the following to my composer.json:

"extra": {
    "laravel": {
        "dont-discover": [
            "laravel/passport",
            "danjdewhurst/laravel-passport-facebook-login"
        ]
    }
}

and then the following to my config/app.php in the providers array:

\Laravel\Passport\PassportServiceProvider::class,
\Danjdewhurst\PassportFacebookLogin\FacebookLoginGrantProvider::class,
Ad
source: stackoverflow.com
Ad