Fix it now
The long-lived grant an application used to obtain new access tokens is no longer accepted, so somebody has to sign in again. This is not evidence of compromise and not a fault to repair: grants age out when unused and are deliberately destroyed by a password change or a session revocation. What you control is how often it happens.
Connect-MgGraph -Scopes "User.ReadWrite.All"
Revoke-MgUserSignInSession -UserId user@contoso.com
- For a single person, have them sign in interactively once. That is the whole fix, and no configuration change is needed.
- If a group was hit at the same moment, look at Entra ID then Monitoring & health then Audit logs for a password reset, a session revocation or a policy change at that timestamp.
- For an application or script, acquire a fresh authorisation interactively rather than retrying the dead grant. Retrying will fail every time.
- For anything unattended, stop using a delegated grant and move to application-only authentication with a certificate, or a managed identity where the workload runs in Azure. Those do not expire this way.
- If users say the prompts are too frequent, check the Conditional Access session controls before assuming a defect. Sign-in frequency and persistent browser session are what set the cadence.
Revoke-MgUserSignInSession invalidates all refresh tokens issued to applications for that user and the session cookies in their browser, by resetting the sign-in sessions valid-from timestamp. It is the right tool for a lost or stolen device and the wrong one for a routine prompt.
If the user signs in and the application gets a token, you are done. If the prompts keep arriving on a schedule, the next section explains what is setting it.
Why it happens
An access token is short-lived on purpose. To avoid asking for credentials every hour, the client also holds a refresh token and exchanges it for new access tokens in the background. That refresh token is tied to a specific user and a specific client application, and it keeps working as long as it is used regularly. Leave it unused past the inactivity window and it stops being accepted, which is what AADSTS700082 describes: an expected part of the token lifecycle, where the user went an extended period without using the application.
Several events destroy the grant immediately rather than letting it age. A password change or reset revokes it. An administrator revoking a user’s sessions revokes it. Disabling the account revokes it. AADSTS50173 is the code for that case, and it is helpfully specific: it names the date the grant was issued and the date before which tokens for this user are no longer valid, so you can line the failure up against the audit log entry that caused it. AADSTS70043 is different again, and means a Conditional Access sign-in frequency check judged the existing token too old to reuse.
Single-page applications are their own case. Because a token held in a browser is more exposed, refresh tokens issued to them carry a short fixed lifetime that cannot be extended, and AADSTS700084 is that limit being reached. There is no configuration that changes it, which makes it the one code on this page where the correct response is to stop looking for a setting. The application has to send a new sign-in request, and silent renewal against the session cookie is what makes that invisible to the user.
The grant went unused for too long
You have this one if AADSTS700082, on a job or an application that runs occasionally rather than daily.
- Sign in interactively once to obtain a new grant.
- For unattended work, register the job as its own application and use application-only authentication with a certificate credential.
- Where the workload runs inside Azure, use a managed identity so there is no credential to age at all.
A scheduled script that ran for months and then stopped is almost always this. It was running on a delegated grant obtained when a person signed in once, and nobody remembered that a person was involved.
A password change or reset revoked the grant
You have this one if AADSTS50173, and the audit log shows a password event for that user just before the failures started.
- Compare the valid-from date in the error against the audit log entry. They should line up exactly.
- Have the user sign in again on every device and application they use; each client holds its own grant.
- Expect mobile mail clients and desktop applications to prompt separately from the browser.
An administrator revoked sessions
You have this one if Sudden failures across many clients for one user or a group, with a matching revocation entry in the audit log.
- Confirm the revocation was deliberate before doing anything else.
- Have affected users sign in again.
- Where you need to do this on purpose,
Revoke-MgUserSignInSession -UserId <upn>is the supported way, and it invalidates browser session cookies as well as refresh tokens.
A sign-in frequency requirement is forcing re-authentication
You have this one if AADSTS70043, with prompts arriving on a predictable schedule that matches a policy interval.
- Find the Conditional Access policy whose session controls set a sign-in frequency, and read the interval.
- Decide it deliberately, weighing the exposure of a long-lived session against the disruption of frequent prompts.
- Scope the tighter interval to the applications and roles that need it rather than to everyone.
- Check persistent browser session separately; it governs whether the session survives closing the browser rather than the token lifetime.
A single-page application has reached its fixed token lifetime
You have this one if AADSTS700084 in a browser-based application, at a regular cadence, unaffected by any policy you change.
- Confirm the application uses the authorisation code flow with proof key, which is the supported pattern for browser applications.
- Ensure silent renewal against the session cookie works, which means not blocking cookies for the sign-in domain.
- Do not look for a setting to extend the lifetime. Microsoft states it is fixed and cannot be extended.
Full reference
Reading who was affected, and when
| Who is affected and when | What that points at |
|---|---|
| One user, right after they changed their password | The credential change revoked the grant, as designed |
| Every user of one application at once | A credential rotation on the application, or a policy change |
| A browser application at a regular short interval | A single-page application reaching its fixed refresh lifetime |
| Only when users are off the corporate network | A location-scoped sign-in frequency requirement |
| A scheduled script that ran for months and stopped | The delegated grant went unused past the inactivity window |
| Many clients for one user, at one timestamp | An administrator revoked that user’s sessions |
Moving unattended work off a human’s session
The single most common version of this problem is a script that authenticated once, interactively, years ago, and has been quietly refreshing ever since. It is fragile in three ways at once: it dies when the person leaves, it dies when their password changes, and it dies if it simply does not run for long enough. None of those is a defect to fix. They are the token lifecycle working as designed on a credential that was never meant to be unattended.
- Register the job as its own application rather than borrowing a person’s identity.
- Give it a certificate credential and use application-only authentication.
- Grant it only the application permissions the job actually needs, and record why each was granted.
- Where the workload runs in Azure, use a managed identity so there is no credential to rotate at all.
- Retire the delegated grant once the new path is proven, rather than leaving both in place.
What the session controls actually govern
| Control | What it does |
|---|---|
| Sign-in frequency | How long a user can stay signed in before being prompted again when accessing a resource |
| Persistent browser session | Whether the user stays signed in after closing and reopening the browser window |
| Revoking a user’s sessions | Invalidates all refresh tokens and browser session cookies immediately |
| Single-page application refresh lifetime | Fixed by the platform, and not adjustable |
These are the levers that exist. If a prompt cadence is wrong, it is one of the first two. Nothing in this list makes a refresh token survive a password change, and nothing should.
When to treat it as an incident rather than a prompt
- The revocation was not expected and cannot be tied to an administrative action in the audit log.
- The failure timestamps cluster around a change to the account’s registered authentication methods.
- A group of users lost their sessions at once and nobody owns the change.
- The account’s recent sign-ins show locations or clients nobody recognises.
- In any of those cases, review the account before you have the user sign in again, because signing in again is exactly what an attacker with a foothold also wants.
When a licence is the actual fix
Signing in again costs nothing, and for most of these codes that is the whole remedy. What a free tenant cannot do is decide how often people are challenged. The controls for that are the Conditional Access session controls, sign-in frequency and persistent browser session, and Conditional Access requires Microsoft Entra ID P1 for the users in scope. Check what you already hold before buying anything: Microsoft 365 Business Premium, Microsoft 365 E3, E5, F1 and F3, and Enterprise Mobility + Security E3 all include Entra ID P1. We can confirm whether your subscription already covers it and supply P1 seats for the users who need it if it does not.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
AADSTS70008 |
ExpiredOrRevokedGrant: the refresh token has expired due to inactivity, having been issued on a given date and unused for a period | Microsoft Learn |
AADSTS700082 |
ExpiredOrRevokedGrantInactiveToken: the user went an extended period without using the application, so the token had expired when the app tried to refresh it. An expected part of the token lifecycle | Microsoft Learn |
AADSTS700084 |
The refresh token was issued to a single-page application and has a fixed, limited lifetime that cannot be extended. A new sign-in request must be sent | Microsoft Learn |
AADSTS50173 |
The grant expired because it was revoked and a fresh token is needed. The message names the issue date and the date before which tokens for this user are not valid | Microsoft Learn |
AADSTS70043 |
BadTokenDueToSignInFrequency: the refresh token expired or is invalid because of sign-in frequency checks by Conditional Access | Microsoft Learn |
Confirm the fix worked
- The affected user completes an interactive sign-in and the application obtains a token without error.
- The audit log entry behind a mass revocation is identified and understood rather than left unexplained.
- Any unattended job now runs on application-only authentication or a managed identity, and has completed a full cycle without a human signing in.
- Prompts that remain line up with a session control interval you set deliberately.
- For a single-page application, silent renewal succeeds after the fixed lifetime is reached rather than showing the user a sign-in page.
Questions people ask about this
Can I make refresh tokens last longer?
Not for a single-page application: Microsoft states its refresh token lifetime is fixed and cannot be extended. For everything else, what you can set is how often users are challenged, using the Conditional Access sign-in frequency and persistent browser session controls.
Does this mean the account was compromised?
Not on its own. Inactivity and password changes account for most of these. If the revocation was not expected and you cannot tie it to an administrative action in the audit log, review the account’s recent sign-ins and registered authentication methods before dismissing it.
Why did my scheduled script stop working after months?
It was almost certainly running on a delegated grant obtained when a person signed in once, and that grant aged out. Move the script to application-only authentication with a certificate, or a managed identity, so it no longer depends on a human session.
What exactly does revoking sessions do?
It invalidates all the refresh tokens issued to applications for that user and the session cookies in their browser, by resetting the timestamp before which tokens are not valid. It is meant for a lost or stolen device, and it will prompt the user on every application and device they use.
Do I need to buy anything to stop the prompts?
Only if you want to control the cadence. Signing in again is free and always works. Setting how often users are challenged, per application or per group, means Conditional Access, which requires Entra ID P1 for those users and is already included in several Microsoft 365 subscriptions.
