Skip to content

Commit

Permalink
fix: access token doesn't generate errors when token expires (#45)
Browse files Browse the repository at this point in the history
* fix: access token doesn't generate errors when token expires

* refactor: deleted unnecessary spaces

* docs: added extra info
  • Loading branch information
julianramirez2 authored Oct 10, 2023
1 parent 2589168 commit 594cd31
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,13 @@ public function enrollment_send_request( $enrollment_data, $enrollment_action )
}

$access_token = $this->check_access_token();
$user = $this->get_user( $enrollment_data['enrollment_email'], $access_token );

// The access token can be an array or not; if it's an array, we need the value at index 1, which contains the generated token.
if ( 'array' === gettype( $access_token ) ) {
$access_token = $access_token[1];
}

$user = $this->get_user( $enrollment_data['enrollment_email'], $access_token );

if ( 'error' === $access_token[0] || 'error' === $user[0] ) {
if ( 'error' === $access_token[0] && 'error' === $user[0] ) {
Expand Down

0 comments on commit 594cd31

Please sign in to comment.