File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -569,6 +569,10 @@ public function isAccessTokenExpired()
569569 }
570570 }
571571 }
572+ if (!isset ($ this ->token ['expires_in ' ])) {
573+ // if the token does not have an "expires_in", then it's considered expired
574+ return true ;
575+ }
572576
573577 // If the token is set to expire in the next 30 seconds.
574578 return ($ created + ($ this ->token ['expires_in ' ] - 30 )) < time ();
Original file line number Diff line number Diff line change @@ -315,6 +315,16 @@ public function testSettersGetters()
315315 $ this ->assertEquals ($ token , $ client ->getAccessToken ());
316316 }
317317
318+ public function testSetAccessTokenValidation ()
319+ {
320+ $ client = new Client ();
321+ $ client ->setAccessToken ([
322+ 'access_token ' => 'token ' ,
323+ 'created ' => time ()
324+ ]);
325+ self ::assertEquals (true , $ client ->isAccessTokenExpired ());
326+ }
327+
318328 public function testDefaultConfigOptions ()
319329 {
320330 $ client = new Client ();
You can’t perform that action at this time.
0 commit comments