Skip to content

Commit

Permalink
refactor: token expiration overlap name changed
Browse files Browse the repository at this point in the history
  • Loading branch information
julianramirez2 committed Sep 8, 2023
1 parent 1523a0d commit 6813a31
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion admin/views/class-openedx-woocommerce-plugin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function set_new_token() {
$exp_time = $response_data['expires_in'];
$exp_date = new DateTime();
$exp_date->add( new DateInterval( 'PT' . $exp_time . 'S' ) );
update_option( 'openedx-token-overlap', $exp_date );
update_option( 'openedx-token-expiration-overlap', $exp_date );

$nonce = wp_create_nonce( 'token_generated_nonce' );
update_option( 'openedx-jwt-token', $response_data['access_token'] );
Expand Down
4 changes: 2 additions & 2 deletions includes/model/class-openedx-woocommerce-plugin-api-calls.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public function enrollment_sync_request( $method, $body, $access_token ) {
*/
public function check_access_token() {

$current_token_exp = get_option( 'openedx-token-overlap' );
$current_token_exp = get_option( 'openedx-token-expiration-overlap' );
$current_token_exp = $current_token_exp->sub( new DateInterval( 'PT300S' ) );
$current_date = new DateTime();

Expand Down Expand Up @@ -373,7 +373,7 @@ public function set_new_token( $new_token, $current_date ) {

$exp_time = $response_data['expires_in'];
$new_exp_date = $current_date->add( new DateInterval( 'PT' . $exp_time . 'S' ) );
update_option( 'openedx-token-overlap', $new_exp_date );
update_option( 'openedx-token-expiration-overlap', $new_exp_date );

return array( 'success', $response_data['access_token'] );
}
Expand Down

0 comments on commit 6813a31

Please sign in to comment.