Skip to content

Commit df38eb9

Browse files
committed
Merge branch 'delete-tokens-401' into add-resource-tests
2 parents 2d48034 + 144a3e3 commit df38eb9

2 files changed

Lines changed: 21 additions & 8 deletions

File tree

includes/class-integrate-convertkit-wpforms-api.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@ class Integrate_ConvertKit_WPForms_API extends ConvertKit_API_V4 {
2929
*/
3030
public $error_messages = false;
3131

32-
/**
33-
* Access Token
34-
*
35-
* @var string
36-
*/
37-
public $access_token = '';
38-
3932
/**
4033
* Sets up the API with the required credentials.
4134
*
@@ -120,4 +113,17 @@ public function __construct( $client_id, $redirect_uri, $access_token = false, $
120113

121114
}
122115

116+
/**
117+
* Returns the access token.
118+
*
119+
* @since 1.8.9
120+
*
121+
* @return string
122+
*/
123+
public function access_token() {
124+
125+
return $this->access_token;
126+
127+
}
128+
123129
}

includes/class-integrate-convertkit-wpforms-resource.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
*/
1515
class Integrate_ConvertKit_WPForms_Resource extends ConvertKit_Resource_V4 {
1616

17+
/**
18+
* The API class
19+
*
20+
* @var bool|Integrate_ConvertKit_WPForms_API
21+
*/
22+
public $api = false;
23+
1724
/**
1825
* Constructor.
1926
*
@@ -57,7 +64,7 @@ public function refresh() {
5764
// If an error occured, maybe delete credentials from the Plugin's settings
5865
// if the error is a 401 unauthorized.
5966
if ( is_wp_error( $result ) ) {
60-
integrate_convertkit_wpforms_maybe_delete_credentials( $result, INTEGRATE_CONVERTKIT_WPFORMS_OAUTH_CLIENT_ID, $this->api->access_token );
67+
integrate_convertkit_wpforms_maybe_delete_credentials( $result, INTEGRATE_CONVERTKIT_WPFORMS_OAUTH_CLIENT_ID, $this->api->access_token() );
6168
}
6269

6370
return $result;

0 commit comments

Comments
 (0)