From 03d6a9f15264330dbe68af0b02d8e5f80b5ee0b8 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 | 52 +++++++++++++++++++++++++ src/Providers/IntuitServiceProvider.php | 3 +- 2 files changed, 54 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..2958b5a --- /dev/null +++ b/src/Commands/TokenRefresh.php @@ -0,0 +1,52 @@ +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, ]); }