File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,13 @@ public function register()
5252 });
5353
5454 $ this ->app ->bind (OauthCredentialManager::class, function (Application $ app ) {
55- return $ app ->make (config ('xero.credential_store ' ));
55+ $ credentials = $ app ->make (config ('xero.credential_store ' ));
56+
57+ if ($ credentials ->exists () && $ credentials ->isExpired ()) {
58+ $ credentials ->refresh ();
59+ }
60+
61+ return $ credentials ;
5662 });
5763
5864 $ this ->app ->bind (Configuration::class, function (Application $ app ) {
@@ -61,10 +67,6 @@ public function register()
6167 $ config ->setHost (config ('xero.api_host ' ));
6268
6369 if ($ credentials ->exists ()) {
64- if ($ credentials ->isExpired ()) {
65- $ credentials ->refresh ();
66- }
67-
6870 $ config ->setAccessToken ($ credentials ->getAccessToken ());
6971 }
7072
You can’t perform that action at this time.
0 commit comments