mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Add token expiration
This commit is contained in:
parent
8411ef2106
commit
4f47b382c5
2 changed files with 6 additions and 3 deletions
|
@ -110,7 +110,9 @@ class SdkClientToken {
|
|||
}
|
||||
|
||||
$access_token = $json->access_token;
|
||||
$this->cache->set( self::CACHE_KEY, $access_token );
|
||||
$expires_in = (int) $json->expires_in;
|
||||
|
||||
$this->cache->set( self::CACHE_KEY, $access_token, $expires_in );
|
||||
|
||||
return $access_token;
|
||||
}
|
||||
|
|
|
@ -115,9 +115,10 @@ class UserIdToken {
|
|||
throw new PayPalApiException( $json, $status_code );
|
||||
}
|
||||
|
||||
$id_token = $json->id_token;
|
||||
$id_token = $json->id_token;
|
||||
$expires_in = (int) $json->expires_in;
|
||||
|
||||
$this->cache->set( self::CACHE_KEY . '-' . (string) get_current_user_id(), $id_token );
|
||||
$this->cache->set( self::CACHE_KEY . '-' . (string) get_current_user_id(), $id_token, $expires_in );
|
||||
|
||||
return $id_token;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue