OAuthException: unsupported_grant_type
Using the example provided, everything worked fine for exactly 3 months from setup.
Then, this error started happening:
[30-Aug-2021 14:06:02 UTC] PHP Fatal error: Uncaught Automile\Sdk\OAuth\OAuthException: unsupported_grant_type in [path]/vendor/automile/automile-php/lib/OAuth/Http.php:106 Stack trace: #0 [path]/vendor/automile/automile-php/lib/AutomileClient.php(182): Automile\Sdk\OAuth\Http->refreshToken(Object(Automile\Sdk\Models\User), Object(Automile\Sdk\OAuth\Token)) #1 [path]/vendor/automile/automile-php/lib/AutomileClient.php(102): Automile\Sdk\AutomileClient->_refreshToken(Object(Automile\Sdk\Models\User), Object(Automile\Sdk\OAuth\Token)) #2 [path]/vendor/automile/automile-php/lib/AutomileClient.php(139): Automile\Sdk\AutomileClient->__construct(Object(Automile\Sdk\OAuth\Token)) #3 [path]/automile.php(35): Automile\Sdk\AutomileClient::fromSavedToken(Object(Automile\Sdk\Storage\Filesystem)) #4 {main} thrown in [path]/vendor/automile/automile-php/lib/OAuth/Http.php on line 106
By removing the automile-token.json file and letting it regenerate this fixes the issue, but I presume it will happen again in 3 months time.