webfox / laravel-xero-oauth2

A Laravel integration for Xero using the Oauth 2.0 spec
MIT License
50 stars 32 forks source link

"Invalid Client" on callback #21

Closed KadHamW closed 4 years ago

KadHamW commented 4 years ago

I am getting the following error after successfully logging in to Xero, so on the callback to the App:

League\OAuth2\Client\Provider\Exception\IdentityProviderException invalid_client

The error is coming from:

league\oauth2-client\src\Provider\GenericProvider.php:222

I have been banging my head against this for a while but so far I can't seem to come up with a resolution. Both my ID and Secret in the .env appear to be correct (if they weren't surely Xero wouldn't have let me log in). I had oauth2 working previously for a different connection and did not receive this error.

KadHamW commented 4 years ago

On further inspection, it appears to be the call from webfox\laravel-xero-oauth2\src\Controllers\AuthorizationCallbackController.php:27 that causes the error. $accessToken = $provider->getAccessToken('authorization_code', $request->only('code'));

hailwood commented 4 years ago

Hi @KadHamW

That's very strange, Unfortunately I've got no real ideas on how to debug this one further without a reproduction. It may be something specific with the scopes that have been granted, or it could be something to do with the cache driver.

I'm going to close this issue for now as there's not a lot we can do to help here, but if you come up with anything further feel free to comment and I'll see what we can do!

gbrits commented 3 years ago

I am running into the same issue here, I am currently using the default scopes. I am using a database session storage though? I had more than the default scopes previously, having adjusted them down to the defaults made no difference. I also tried updating my oauth2-client deps to no avail.

gbrits commented 3 years ago

I just re-generated my client / secret, updated my .env and php artisan optimize cleaned it all out, tried again and it worked, with the additional scopes, so it was just an actual INVALID CLIENT, who woulda thunk. Thanks guys.