-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Description
Hey again,
I am loving the package, I have been able to integrate it into my app quite well.
The only issue I am having is the 30-minute timeout of the tokens,
I am unsure whether the package is supposed to handle this seamlessly in the background, but if that is the case it is not quite working.
Instead, I am trying to create a scheduled command that will refresh my tokens.
It appears to successfully generate new tokens, but either it isn't saving it properly back to the conf or something else is going on.
I am using the DB for my cache and that is working fine with the token info being added as expected.
So far I have this in the command, although it has been through many iterations and might be flat out wrong:
public function handle()
{
Log::info('Xero Heartbeat command run');
try {
$credentials = app(OauthCredentialManager::class);
$config = app(Configuration::class);
$oldTok = $config->getAccessToken();
$credentials->refresh();
$config->setAccessToken($credentials->getAccessToken());
$newTok = $config->getAccessToken();
Log::info("Token old: " . $oldTok . ". Token new: " . $newTok);
} catch (\throwable $e) {
Log::info("An error occured: " . $e->getMessage());
}
}
Metadata
Metadata
Assignees
Labels
No labels