webfox/laravel-xero-oauth2

[BUG]For Credential Storage, the rebinding in AppServiceProvider does not seem to be triggered

Closed this issue · 1 comments

Describe the bug
I tried rebinding in both boot() and register() method, but I am unable to see the test result '123'. And the user object is not passed into the class.

In my Providers/AppServiceProvider.php:

use App\Xero\UserStorageProvider;
use Illuminate\Foundation\Application;

$this->app->bind(OauthCredentialManager::class, function(Application $app) {

   dd(123); // ***********TEST IF REACHES THIS LINE***********

    return new UserStorageProvider(
        \Auth::user(), // Storage Mechanism 
        $app->make('session.store'), // Used for storing/retrieving oauth 2 "state" for redirects
        $app->make(\Webfox\Xero\Oauth2Provider::class) // Used for getting redirect url and refreshing token
    );
});

In my config/xero.php:

use App\Xero\UserStorageProvider;

'credential_store' => UserStorageProvider::class,

To Reproduce
Exactly like above.

Expected behavior
When I go to '/xero/auth/authorize', I expect to see '123'.

Solved. In case anyone makes the same mistake:

You have to include this line:

use Webfox\Xero\OauthCredentialManager;

in Providers/AppServiceProvider.php.