Skip to content

Commit

Permalink
MDL-52051 oauth: expires_in is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Oct 10, 2016
1 parent 7223cd2 commit 72de799
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/oauthlib.php
Expand Up @@ -517,7 +517,10 @@ public function upgrade_token($code) {
// Store the token an expiry time.
$accesstoken = new stdClass;
$accesstoken->token = $r->access_token;
$accesstoken->expires = (time() + ($r->expires_in - 10)); // Expires 10 seconds before actual expiry.
if (isset($r->expires_in)) {
// Expires 10 seconds before actual expiry.
$accesstoken->expires = (time() + ($r->expires_in - 10));
}
$this->store_token($accesstoken);

return true;
Expand Down

0 comments on commit 72de799

Please sign in to comment.