Detect and respond to per-show token revocation so add-ons can pause outbound work before the operator reconnects
When a show’s daily licence check comes back unauthorized, Benecaster does not act on the first failure — it counts. Authentication fails transiently often enough that one rejection is not evidence of anything.
The first rejection fires benecaster_license_unauthorized_strike( int $strike_count, string $show_uuid ). That is a signal worth watching, not yet a reason to stop work. A second consecutive rejection fires benecaster_license_reconnect_required( string $show_uuid ) and flags the show as needing the operator to reconnect it.
The counter is per show. A revocation on one show has no effect on the other shows connected to the same site.
Use the strike action to alert on transient auth problems, and the reconnect-required action to pause outbound work for that show until it is reconnected.
Code
<?php
add_action( 'benecaster_license_unauthorized_strike', function ( int $strike_count, string $show_uuid ): void {
// First strike is usually a transient header-stripping incident — log it
// so operators can correlate against host proxy anomalies, but do not
// change behavior yet. Strike 2 fires the reconnect_required action.
my_addon_metric( 'benecaster.license.401_strike', [
'count' => $strike_count,
'show_uuid' => $show_uuid,
] );
}, 10, 2 );
add_action( 'benecaster_license_reconnect_required', function ( string $show_uuid ): void {
// Pause outbound work for this specific show — other shows are unaffected.
// The Reconnect to Benecaster admin notice already prompts the operator.
my_addon_pause_outbound_syncs_for_show( $show_uuid );
} );
Hooks Used
Need this built rather than just documented? See our services →