# boolean_smtp_microsoft_token_url

> Filters the Microsoft identity platform token endpoint used to exchange or refresh delegated and application tokens.

Filter · Tier B · Since 1.0.0

Return a different URL to override the resolved endpoint, for example for a sovereign cloud. Fired wherever the plugin or the Pro add-on talks to the token endpoint: the manual and scheduled refreshes, the Graph sender, the credential check and the application-permission mailer.

## Signature

```php
add_filter( 'boolean_smtp_microsoft_token_url', $callback, 10, 2 );
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `$url` | `string` | Token endpoint URL built from the tenant: `https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token`. |
| `$tenant` | `string` | Microsoft tenant id or domain, or `common`, `organizations`, `consumers`. |

**Returns** `string` — The filtered URL.

## Fires in

- [app/Http/Controllers/ConnectionController.php:1606](https://github.com/booleanpress/boolean-smtp-src/blob/main/app/Http/Controllers/ConnectionController.php#L1606) — `BooleanSmtp\Http\Controllers\ConnectionController::verifyOutlookCredentials()`
- [app/Http/Controllers/OAuthController.php:651](https://github.com/booleanpress/boolean-smtp-src/blob/main/app/Http/Controllers/OAuthController.php#L651) — `BooleanSmtp\Http\Controllers\OAuthController::microsoftTokenUrl()`
- [app/Services/Mailer/Api/MicrosoftGraphMailSender.php:1038](https://github.com/booleanpress/boolean-smtp-src/blob/main/app/Services/Mailer/Api/MicrosoftGraphMailSender.php#L1038) — `BooleanSmtp\Services\Mailer\Api\MicrosoftGraphMailSender::getValidAccessToken()`
- [app/Services/Mailer/OAuth/OAuthManualTokenExchange.php:243](https://github.com/booleanpress/boolean-smtp-src/blob/main/app/Services/Mailer/OAuth/OAuthManualTokenExchange.php#L243) — `BooleanSmtp\Services\Mailer\OAuth\OAuthManualTokenExchange::microsoft()`
- [boolean-smtp-pro/app/Services/Mailer/Api/MicrosoftAppPermissionMailer.php:137](https://github.com/booleanpress/boolean-smtp-src/blob/main/boolean-smtp-pro/app/Services/Mailer/Api/MicrosoftAppPermissionMailer.php#L137) — `BooleanSmtpPro\Services\Mailer\Api\MicrosoftAppPermissionMailer::getAccessToken()`

## Example

```php
add_filter( 'boolean_smtp_microsoft_token_url', function ( string $url, string $tenant ) {
    return $url;
}, 10, 2 );
```
