# booleanpress_auth_failure

> Fires when a request is rejected by the authentication middleware.

Action · Tier B · Since 0.2.3

Runs after the failure has been written to the PHP error log, so a plugin can forward it to its own security monitoring.

## Signature

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

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `$data` | `array<string, mixed>` | Failure details: `type` (`auth_failure`), `reason`, `ip`, `path`, `method`, `user_agent`, `timestamp`, `required_capability` when a capability was checked and `user_id` when a user was logged in. |

## Fires in

- [vendor/booleanpress/core/src/Http/Middleware/AuthMiddleware.php:122](https://github.com/booleanpress/boolean-smtp-src/blob/main/vendor/booleanpress/core/src/Http/Middleware/AuthMiddleware.php#L122) — `BooleanSmtp\Core\Http\Middleware\AuthMiddleware::logAuthFailure()`

## Example

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