When the Oauth grant expires and the token can no longer be refreshed, uzERP returns the content of the error message in the http response instead of redirecting to HMRC for the user to re-authorize the application.
MTD::refreshToken must start authorizationGrant when an invalid_grant error is received.
// If authorization grant has expired, re-authorise application
// >>> re-auth on invalid_grant
if ($response['error'] == 'invalid_request' || $response['error'] == 'invalid_grant') {
$storage->deleteToken($this->config_key);
$this->authorizationGrant();
}
$flash->addWarning("Oauth Error: {$response['error']}, {$response['error_description']}");
return false;
When the Oauth grant expires and the token can no longer be refreshed, uzERP returns the content of the error message in the http response instead of redirecting to HMRC for the user to re-authorize the application.
MTD::refreshToken must start
authorizationGrant
when an invalid_grant error is received.