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()
569
569
}
570
570
}
571
571
}
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
+ }
572
576
573
577
// If the token is set to expire in the next 30 seconds.
574
578
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()
315
315
$ this ->assertEquals ($ token , $ client ->getAccessToken ());
316
316
}
317
317
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
+
318
328
public function testDefaultConfigOptions ()
319
329
{
320
330
$ client = new Client ();
You can’t perform that action at this time.
0 commit comments