Auth0 Emails Suddenly Stop Sending for Microsoft 365 Email Provider
Last Updated:
Overview
Emails suddenly stop sending for all users when using the Microsoft 365 email provider because the Azure client credentials expire. Generate a new set of client credential keys for the Azure client and update the Auth0 email provider credentials to resolve this issue.
Applies To
- Auth0
- Custom Database Connections
- Custom Database Scripts
Cause
The Azure client credentials expire and require renewal. When this occurs, an error appears in the tenant logs for type:fn (failed notifications) events.
{
"date": "timestamp here",
"type": "fn",
"description": "To: example@email.com",
"connection": "Connection name here",
"connection_id": "",
"client_id": "client ID here",
"details": {
"email_type": "verify_email",
"notification_type": "verify_email",
"to": "example@email.com",
"error": "Error sending email: invalid_client: 7000222 - [Timestamp
Z]: AADSTS7000222: The provided client secret keys for app 'Azure client ID here' are expired. Visit the Azure portal to create new keys for your app: https://aka.ms/NewClientSecret, or consider using certificate credentials for added security: https://aka.ms/certCreds..."
},
"user_id": "user ID here",
"user_name": "username here",
"log_id": "log id here",
"tenant_name": "your name here",
"_id": "id",
"isMobile": false,
"user_agent": "Other 0.0.0 / Other 0.0.0"
}
Solution
Renew the Azure client credentials to resume email sending.
Generate a new set of client credential keys for the relevant Azure client and update the Auth0 email provider credentials to restore email delivery.
- Create a new set of client credential keys for the relevant Azure client that the tenant email provider uses.
- Update the tenant email provider credentials with the new keys.
What steps test the credentials outside of Auth0?
If the error remains after submitting the new client secret in the tenant email provider settings, the configuration might use the Secret ID instead of the Value property. Verify the credentials outside of Auth0 by replacing the placeholder values in the provided curl command and executing it in a terminal window to check for a 200 OK status.
- Replace
<NAME_CLIENT_ID>,<CLIENT_SECRET_NAME>, and<TENANT_ID_OR_DOMAIN_NAME>with the appropriate values in the following curl command.
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=<CLIENT_ID_NAME>&client_secret=<CLIENT_SECRET_NAME>&scope=https://graph.microsoft.com/.default" \
"https://login.microsoftonline.com/<TENANT_ID_OR_DOMAIN_NAME>/oauth2/v2.0/token"
- Execute the command in a terminal/command prompt window.
- Observe the results. A 200 OK status indicates that the credentials are accurate.