Skip to content

Commit

Permalink
Merge pull request #112 from cmanon/feature/109-error-unauthorized
Browse files Browse the repository at this point in the history
Added extra debugging
  • Loading branch information
jrfoell authored Sep 24, 2021
2 parents a2d2e20 + 6ae49da commit 0556c90
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ On the WP-Strava settings page you cannot currently remove and add another athle
Add ability to paste Activity/Route/Segment URL into the block editor and have it insert the appropriate block https://wordpress.org/support/topic/sorry-this-content-could-not-be-embedded-5/
Add `reduce_polyline()` for maps with large polylines but no summary provided (prevents empty map) https://wordpress.org/support/topic/map-embed-from-segment-shows-default-map/
Fix for ActivitiesList where lists were showing all zeroes https://wordpress.org/support/topic/zero-on-all-activities-for-club-on-list-mocule/
Add additional authorization error logging to troubleshoot 401 Unauthorized https://wordpress.org/support/topic/wp-strava-error-401-unauthorized/


= 2.9.1 =
Expand Down
13 changes: 12 additions & 1 deletion src/WPStrava/AuthRefresh.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,23 @@ public function setup_auth_refresh_cron() {
/**
* Cron method to refresh auth tokens from Strava.
*
* @throws WPStrava_Exception
* @author Justin Foell
* @since 2.0.0
*/
public function auth_refresh() {
$settings = WPStrava::get_instance()->settings;
foreach ( $settings->info as $client_id => $info ) {
$info = $settings->info;

if ( ! is_array( $info ) ) {
$message = 'strava_info should be an array, received: ' . var_export( $info, true ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export -- Debug only.
if ( WPSTRAVA_DEBUG ) {
error_log( $message ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- Debug only.
}
throw new WPStrava_Exception( $message );
}

foreach ( $info as $client_id => $info ) {
if ( ! empty( $info->refresh_token ) ) {
$this->token_exchange_refresh( $client_id, $info );
}
Expand Down

0 comments on commit 0556c90

Please sign in to comment.