Weble / ZohoBooksApi

40 stars 41 forks source link

local.ERROR: invalid_code #84

Closed stojankukrika closed 3 years ago

stojankukrika commented 3 years ago

Hi, I have one issue with this package if someone can help me. Connection to Zoho Books works well I get also a refresh token (offline mode) which is awesome. But I have issues for example to get all invoices or count invoices. When I try to get total invoices I made this code: $total = $this->getClient()->invoices->getTotal();

where getClient method is this one:

use Weble\ZohoClient\OAuthClient;
use Webleit\ZohoBooksApi\Client;
use Webleit\ZohoBooksApi\ZohoBooks;

trait ZohoBooksRemote
{
    protected function getClient()
    {
        $oAuthClient = new OAuthClient(setting('zohobooks.client_id'), setting('zohobooks.client_secret'));
        $oAuthClient->setRefreshToken(setting('zohobooks.refresh_token'));
        $oAuthClient->offlineMode();

        $client = new Client($oAuthClient);
//// with next line and without this line result is the same
//        $client->setOrganizationId(setting('zohobooks.organization_id')); 

        return new ZohoBooks($client);
    }
}

and get this error: local.ERROR: invalid_code {"userId":1,"exception":"[object] (League\\OAuth2\\Client\\Provider\\Exception\\IdentityProviderException(code: 200): invalid_code at /home/vagrant/projects/akaunting/modules/ZohoBooks/vendor/asad/oauth2-zoho/src/Provider/Zoho.php:112)

Skullbock commented 3 years ago

Try adding also the access Token to the client, even if expired. I think the client tried to authenticate again using a auth_code (which is the first step you do to take the refresh token in the first place) if it doesn't find an access token.

stojankukrika commented 3 years ago

@Skullbock you thing to add this: $oAuthClient->setAccessToken(setting('zohobooks.token')); after this line: $oAuthClient->setRefreshToken(setting('zohobooks.refresh_token')); ? I get the same error.

Skullbock commented 3 years ago

Yes. Can you show the full backtrace of the exception?

stojankukrika commented 3 years ago

Sure. `[2021-07-22 10:32:01] local.ERROR: invalid_code {"userId":1,"exception":"[object] (League\OAuth2\Client\Provider\Exception\IdentityProviderException(code: 200): invalid_code at /home/vagrant/projects/akaunting/modules/ZohoBooks/vendor/asad/oauth2-zoho/src/Provider/Zoho.php:112) [stacktrace]

0 /home/vagrant/projects/akaunting/modules/ZohoBooks/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(628): Asad\OAuth2\Client\Provider\Zoho->checkResponse()

1 /home/vagrant/projects/akaunting/modules/ZohoBooks/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(537): League\OAuth2\Client\Provider\AbstractProvider->getParsedResponse()

2 /home/vagrant/projects/akaunting/modules/ZohoBooks/vendor/weble/zohoclient/src/OAuthClient.php(378): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken()

3 /home/vagrant/projects/akaunting/modules/ZohoBooks/vendor/weble/zohoclient/src/OAuthClient.php(275): Weble\ZohoClient\OAuthClient->refreshAccessToken()

4 /home/vagrant/projects/akaunting/modules/ZohoBooks/vendor/weble/zohoclient/src/OAuthClient.php(240): Weble\ZohoClient\OAuthClient->getAccessTokenObject()

5 /home/vagrant/projects/akaunting/modules/ZohoBooks/vendor/webleit/zohobooksapi/src/Client.php(221): Weble\ZohoClient\OAuthClient->getAccessToken()

6 /home/vagrant/projects/akaunting/modules/ZohoBooks/vendor/webleit/zohobooksapi/src/Client.php(194): Webleit\ZohoBooksApi\Client->getHttpClientOptions()

7 /home/vagrant/projects/akaunting/modules/ZohoBooks/vendor/webleit/zohobooksapi/src/Client.php(132): Webleit\ZohoBooksApi\Client->call()

8 /home/vagrant/projects/akaunting/modules/ZohoBooks/vendor/webleit/zohobooksapi/src/Modules/Module.php(87): Webleit\ZohoBooksApi\Client->getList()

9 /home/vagrant/projects/akaunting/modules/Zohobooks/Http/Controllers/Taxes.php(45): Webleit\ZohoBooksApi\Modules\Module->getTotal()

10 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): Modules\ZohoBooks\Http\Controllers\Taxes->count()

11 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction()

12 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Route.php(254): Illuminate\Routing\ControllerDispatcher->dispatch()

13 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Route.php(197): Illuminate\Routing\Route->runController()

14 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Router.php(695): Illuminate\Routing\Route->run()

15 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Routing\Router->Illuminate\Routing\{closure}()

16 /home/vagrant/projects/akaunting/modules/ZohoBooks/Http/Middleware/ZohoBooksRefreshToken.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

17 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Modules\ZohoBooks\Http\Middleware\ZohoBooksRefreshToken->handle()

18 /home/vagrant/projects/akaunting/modules/ZohoBooks/Http/Middleware/ZohoBooksEnabled.php(23): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

19 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Modules\ZohoBooks\Http\Middleware\ZohoBooksEnabled->handle()

20 /home/vagrant/projects/akaunting/vendor/santigarcor/laratrust/src/Middleware/LaratrustPermission.php(25): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

21 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Laratrust\Middleware\LaratrustPermission->handle()

22 /home/vagrant/projects/akaunting/app/Http/Middleware/AdminMenu.php(30): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

23 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\AdminMenu->handle()

24 /home/vagrant/projects/akaunting/app/Http/Middleware/RedirectIfWizardNotCompleted.php(20): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

25 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\RedirectIfWizardNotCompleted->handle()

26 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

27 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Routing\Middleware\SubstituteBindings->handle()

28 /home/vagrant/projects/akaunting/app/Http/Middleware/IdentifyCompany.php(48): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

29 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\IdentifyCompany->handle()

30 /home/vagrant/projects/akaunting/app/Http/Middleware/LogoutIfUserDisabled.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

31 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\LogoutIfUserDisabled->handle()

32 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(44): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

33 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Auth\Middleware\Authenticate->handle()

34 /home/vagrant/projects/akaunting/vendor/akaunting/laravel-firewall/src/Abstracts/Middleware.php(29): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

35 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Akaunting\Firewall\Abstracts\Middleware->handle()

36 /home/vagrant/projects/akaunting/vendor/akaunting/laravel-firewall/src/Abstracts/Middleware.php(29): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

37 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Akaunting\Firewall\Abstracts\Middleware->handle()

38 /home/vagrant/projects/akaunting/vendor/akaunting/laravel-firewall/src/Abstracts/Middleware.php(29): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

39 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Akaunting\Firewall\Abstracts\Middleware->handle()

40 /home/vagrant/projects/akaunting/vendor/akaunting/laravel-firewall/src/Abstracts/Middleware.php(29): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

41 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Akaunting\Firewall\Abstracts\Middleware->handle()

42 /home/vagrant/projects/akaunting/vendor/akaunting/laravel-firewall/src/Abstracts/Middleware.php(29): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

43 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Akaunting\Firewall\Abstracts\Middleware->handle()

44 /home/vagrant/projects/akaunting/vendor/akaunting/laravel-firewall/src/Abstracts/Middleware.php(29): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

45 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Akaunting\Firewall\Abstracts\Middleware->handle()

46 /home/vagrant/projects/akaunting/vendor/akaunting/laravel-firewall/src/Abstracts/Middleware.php(29): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

47 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Akaunting\Firewall\Abstracts\Middleware->handle()

48 /home/vagrant/projects/akaunting/vendor/akaunting/laravel-firewall/src/Abstracts/Middleware.php(29): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

49 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Akaunting\Firewall\Abstracts\Middleware->handle()

50 /home/vagrant/projects/akaunting/vendor/akaunting/laravel-firewall/src/Abstracts/Middleware.php(29): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

51 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Akaunting\Firewall\Abstracts\Middleware->handle()

52 /home/vagrant/projects/akaunting/vendor/akaunting/laravel-firewall/src/Abstracts/Middleware.php(29): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

53 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Akaunting\Firewall\Abstracts\Middleware->handle()

54 /home/vagrant/projects/akaunting/vendor/akaunting/laravel-firewall/src/Abstracts/Middleware.php(29): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

55 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Akaunting\Firewall\Abstracts\Middleware->handle()

56 /home/vagrant/projects/akaunting/vendor/akaunting/laravel-language/src/Middleware/SetLocale.php(95): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

57 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Akaunting\Language\Middleware\SetLocale->handle()

58 /home/vagrant/projects/akaunting/app/Http/Middleware/AddXHeader.php(18): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

59 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\AddXHeader->handle()

60 /home/vagrant/projects/akaunting/app/Http/Middleware/RedirectIfNotInstalled.php(20): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

61 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\RedirectIfNotInstalled->handle()

62 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

63 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle()

64 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

65 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\View\Middleware\ShareErrorsFromSession->handle()

66 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

67 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Session\Middleware\StartSession->handleStatefulRequest()

68 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Session\Middleware\StartSession->handle()

69 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

70 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle()

71 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

72 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\EncryptCookies->handle()

73 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

74 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Router.php(697): Illuminate\Pipeline\Pipeline->then()

75 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Router.php(672): Illuminate\Routing\Router->runRouteWithinStack()

76 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Router.php(636): Illuminate\Routing\Router->runRoute()

77 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Routing/Router.php(625): Illuminate\Routing\Router->dispatchToRoute()

78 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(166): Illuminate\Routing\Router->dispatch()

79 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()

80 /home/vagrant/projects/akaunting/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(60): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

81 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle()

82 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

83 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()

84 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle()

85 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

86 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()

87 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TrimStrings->handle()

88 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

89 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()

90 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

91 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle()

92 /home/vagrant/projects/akaunting/vendor/fruitcake/laravel-cors/src/HandleCors.php(38): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

93 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\Cors\HandleCors->handle()

94 /home/vagrant/projects/akaunting/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

95 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\Proxy\TrustProxies->handle()

96 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustHosts.php(48): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

97 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Http\Middleware\TrustHosts->handle()

98 /home/vagrant/projects/akaunting/vendor/dingo/api/src/Http/Middleware/Request.php(111): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

99 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Dingo\Api\Http\Middleware\Request->handle()

100 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()

101 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(141): Illuminate\Pipeline\Pipeline->then()

102 /home/vagrant/projects/akaunting/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()

103 /home/vagrant/projects/akaunting/index.php(20): Illuminate\Foundation\Http\Kernel->handle()

104 {main}

"} `

Skullbock commented 3 years ago

Are you sure the refresh token you're setting is correct, and with the correct permission for the client id you are using? Seems like the system is trying to create a new refresh token

stojankukrika commented 3 years ago

Hm.. I think it is... but let you check it. I have one middleware that is called before every request related to Zoho:

public function handle($request, Closure $next)
    {
        $client = new OAuthClient(setting('zohobooks.client_id'), setting('zohobooks.client_secret'));
        $client->setRefreshToken(setting('zohobooks.refresh_token'));
        $client->offlineMode();

        setting()->set('zohobooks.refresh_token', $client->refreshAccessToken());
        setting()->save();

        return $next($request);
    }

which store every time new refresh token.

On the first step to Authenticate to Zoho I have this:

$client = new \Weble\ZohoClient\OAuthClient(setting('zohobooks.client_id'), setting('zohobooks.client_secret'), 'us', url('/zohobooks/auth'));
        $client->offlineMode();

when back from Zoho I store info into the database:

setting()->set([
                    'zohobooks.refresh_token'                  => $client->getRefreshToken(),
                    'zohobooks.token'                          => $client->getAccessToken(),
                ]);
                setting()->save();
Skullbock commented 3 years ago

You dont' need to store a new refresh token every time, the refresh token is always the same one. You need to store the refreshed access token

stojankukrika commented 3 years ago

Bro, you are a rock!!! AWESOME!!! Finally get something :D Thank you a lot for your time! If I can help you in anything be free to contact me ;)

Skullbock commented 3 years ago

No worries, OAuth2 is hard 👍

Just use the library, and PR any improvement to code / docs you see (this library or any other one)