# boolean_smtp_oauth_refresh_success

> Fires after an OAuth token refresh succeeds.

Action · Tier A · Since 1.0.0

Fired by the scheduled refresh job and by a manual refresh from the admin UI alike, with the same payload.

## Signature

```php
add_action( 'boolean_smtp_oauth_refresh_success', $callback, 10, 1 );
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `$payload` | `array<string, mixed>` |  |
| &nbsp;&nbsp;`connection_id` | `int` | Id of the refreshed connection. |
| &nbsp;&nbsp;`driver` | `string` | Normalized OAuth driver (`google`, `outlook`, `zoho`). |
| &nbsp;&nbsp;`attempts` | `int` | Number of attempts made. |
| &nbsp;&nbsp;`response_time_ms` | `int` | Time the token exchange took, in milliseconds. |
| &nbsp;&nbsp;`token_expires_at` | `int|null` | Unix timestamp the new token expires at, null when unknown. |
| &nbsp;&nbsp;`token_seconds_remaining` | `int|null` | Seconds remaining until expiry, null when unknown. |

## Fires in

- [app/Http/Controllers/ConnectionController.php:1816](https://github.com/booleanpress/boolean-smtp-src/blob/main/app/Http/Controllers/ConnectionController.php#L1816) — `BooleanSmtp\Http\Controllers\ConnectionController::refreshOAuthNow()`
- [app/Jobs/OAuthRefreshJob.php:217](https://github.com/booleanpress/boolean-smtp-src/blob/main/app/Jobs/OAuthRefreshJob.php#L217) — `BooleanSmtp\Jobs\OAuthRefreshJob::handle()`

## Example

```php
add_action( 'boolean_smtp_oauth_refresh_success', function ( array $payload ) {
    // React to the event.
}, 10, 1 );
```
