-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid_grant error #196
Comments
Hi @youwe, It looks like you need to specify the grant_type when requesting the new access token. You would also need to ensure you have offline_access included in your scopes. For sanity, I would also check that the app is still connected from within Xero connected apps under settings. |
Updated the code, but still the same issue. $newAccessToken = $provider->getAccessToken('refresh_token', [ Offline_access was already added. And the app is still connected. |
@youwe try disconnecting the app completely and getting completely fresh tokens through the auth process again. You could then manually trigger the access token expiry and attempt this new code for a new access token. |
Issue has been resolved. Seems the ID tokens of Xero have changed in format. So now with a base64 encoding the string became much longer and the storage column was not capable in storing the id length. |
@youwe What size of the column you have set to store the ID tokens? Did you set TEXT type? or Varchar? |
@rodjsta I did follow your steps and changed code, disconnected apps, reconnected with new client_id and secret but did not work for me. Fatal error: Uncaught League\OAuth2\Client\Provider\Exception\IdentityProviderException: invalid_grant in C:\xampp\htdocs\myphp_version\vendor\league\oauth2-client\src\Provider\GenericProvider.php:222 Stack trace: #0 C:\xampp\htdocs\myphp_version\vendor\league\oauth2-client\src\Provider\AbstractProvider.php(628): League\OAuth2\Client\Provider\GenericProvider->checkResponse(Object(GuzzleHttp\Psr7\Response), Array) #1 C:\xampp\htdocs\myphp_version\vendor\league\oauth2-client\src\Provider\AbstractProvider.php(537): League\OAuth2\Client\Provider\AbstractProvider->getParsedResponse(Object(GuzzleHttp\Psr7\Request)) #2 C:\xampp\htdocs\myphp_version\authorizedResource.php(25): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken(Object(League\OAuth2\Client\Grant\RefreshToken), Array) #3 {main} thrown in C:\xampp\htdocs\myphp_version\vendor\league\oauth2-client\src\Provider\GenericProvider.php on line 222 |
How did you resolve this issue ? i have same error |
Does anyone know where this suddenly comes from.
It was working just fine, but suddenly after some updates the process died.
Fatal error: Uncaught League\OAuth2\Client\Provider\Exception\IdentityProviderException: invalid_grant in /resources/fileshare/releases/20201223173700/htdocs/vendor/league/oauth2-client/src/Provider/GenericProvider.php:222 Stack trace: #0 /resources/fileshare/releases/20201223173700/htdocs/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(628): League\OAuth2\Client\Provider\GenericProvider->checkResponse(Object(GuzzleHttp\Psr7\Response), Array) #1 /resources/fileshare/releases/20201223173700/htdocs/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(537): League\OAuth2\Client\Provider\AbstractProvider->getParsedResponse(Object(GuzzleHttp\Psr7\Request)) #2 /resources/fileshare/releases/20201223173700/htdocs/rest/lib/xero/authorizedResource.php(29): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken(Object(League\OAuth2\Client\Grant\RefreshToken), Array) #3 {main} thrown in /resources/fileshare/releases/20201223173700/htdocs/vendor/league/oauth2-client/src/Provider/GenericProvider.php on line 222
$newAccessToken = $_provider->getAccessToken('refresh_token', [
'refresh_token' => $this->_storage->getRefreshToken()
]);
The text was updated successfully, but these errors were encountered: