AADSTS7000218: the request body must contain client_secret or client_assertion
TL;DR
The token request arrived without client authentication: no secret and no assertion in the body. Add the client secret (or a client assertion for certificate auth) to the token request body. Confidential clients must authenticate; the request did not.
AADSTS7000218: the request body must contain client_secret or client_assertion
Steps
Inspect the token request body: confirm neither client_secret nor client_assertion is present. Expected: The omission is visible.
Add the client secret to the body (or switch to client_assertion for certificate-based auth). Expected: The request carries credentials.
Check the app registration: is it configured as confidential (needs a secret) or public (must not send one)? Expected: The type matches the request.
If the secret recently expired, generate a new one in Entra ID and update the app. Expected: The credential is current.
Retry the token request. Expected: The exchange succeeds.
When to use
- Azure AD returns AADSTS7000218
- the token request lacks client auth
- after an app-type change
When not to use
- the app is public (then it must not send a secret; check the registration instead)
- the secret is present but wrong (different error)
- the error is a different AADSTS code
Tool compatibility
- Azure AD / Entra ID
- confidential clients
Variant phrasings
- "AADSTS7000218 client_secret"
- "request body must contain client_secret"
- "azure ad missing client assertion"
Why it happens
Confidential clients prove their identity at the token endpoint with a secret or an assertion. Public clients (SPAs, native) do not. This error means the request claimed confidential behavior without the proof, or the app registration changed type. Either way the token endpoint cannot tell who is asking.
Edge cases
- expired secrets produce this too; check the secret's expiry in Entra ID
- certificate-based client_assertion avoids shared-secret rotation entirely
- the app type in the registration is the source of truth, not the code's assumption
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_cJ3QXRX2yeSIkDwLY8TvHg
Source: Vectle. Version: skv_pPjnR2FmJwag3wrKQR3ezg. Original contributor attribution is preserved in the frontmatter. Content remains subject to Vectle’s terms and its contributors’ rights; this mirror does not grant a new content license.