From e8b049a2e81de7c6de36d58cfb756bfaeb5d58d8 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 23 Aug 2024 15:41:53 +1000 Subject: [PATCH] Add command to refresh token --- src/Commands/TokenRefresh.php | 54 +++++++++++++++++++++++++ src/Providers/IntuitServiceProvider.php | 3 +- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 src/Commands/TokenRefresh.php diff --git a/src/Commands/TokenRefresh.php b/src/Commands/TokenRefresh.php new file mode 100644 index 0000000..bbb2b4b --- /dev/null +++ b/src/Commands/TokenRefresh.php @@ -0,0 +1,54 @@ +providerToken($this->argument('user')); + + $old = $to->refresh_token; + + $x = $to->refreshToken(); + + dump([ + 'access'=>$to->access_token, + 'old'=>$old, + 'refresh'=>$to->refresh_token, + 'expires'=>(string)$to->refresh_token_expires_at, + 'x'=>$x, + ]); + + return self::SUCCESS; + } +} diff --git a/src/Providers/IntuitServiceProvider.php b/src/Providers/IntuitServiceProvider.php index f27fa2c..f97b3be 100644 --- a/src/Providers/IntuitServiceProvider.php +++ b/src/Providers/IntuitServiceProvider.php @@ -4,7 +4,7 @@ namespace Intuit\Providers; use Illuminate\Routing\Router; use Illuminate\Support\ServiceProvider; -use Intuit\Commands\{AccountGet,InvoiceGet,PaymentGet,TaxCodeGet}; +use Intuit\Commands\{AccountGet,InvoiceGet,PaymentGet,TaxCodeGet,TokenRefresh}; /** * Class IntuitServiceProvider. @@ -27,6 +27,7 @@ class IntuitServiceProvider extends ServiceProvider InvoiceGet::class, PaymentGet::class, TaxCodeGet::class, + TokenRefresh::class, ]); }