<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/revoking-a-role-is-useless-if-the-session-keeps-the-old-one-iwyn0cmcg" -->

---
title: Revoking a role is useless if the session keeps the old one
description: Changing a user's role in the database does not immediately revoke access if their session or JWT still carries the old role claim, since that claim can remain...
canonical: https://daily.dev/posts/revoking-a-role-is-useless-if-the-session-keeps-the-old-one-iwyn0cmcg
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Revoking a role is useless if the session keeps the old one | daily.dev
og:description: Changing a user's role in the database does not immediately revoke access if their session or JWT still carries the old role claim, since that claim can remain...
og:url: https://daily.dev/posts/revoking-a-role-is-useless-if-the-session-keeps-the-old-one-iwyn0cmcg
og:image: https://api.daily.dev/og/posts/iwYn0CMCG.png
og:image:alt: Revoking a role is useless if the session keeps the old one
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Revoking a role is useless if the session keeps the old one

**[Auth By Example](https://daily.dev/sources/7eadcwhmohx0bchehapmt)** · [@authbyexample](https://daily.dev/authbyexample) · 1 min read · 0 upvotes · 0 comments

## Summary

Changing a user's role in the database does not immediately revoke access if their session or JWT still carries the old role claim, since that claim can remain valid for hours. The fix is to treat role membership as live state: re-check current roles on sensitive paths, use short-lived tokens with forced re-authentication after privilege changes, and invalidate or refresh active sessions immediately on privilege downgrades.

## Content

If you change someone's role in the database but their session or JWT still carries the previous role claim for hours, you did not revoke access — you scheduled a delay.

Treat role membership as live state. On sensitive paths, re-check current roles, or use short TTLs plus forced re-auth after privilege changes. Privilege downgrades should invalidate or refresh active sessions immediately.

## Similar posts on daily.dev

- [Revoke a JWT Before It Expires: Refresh Tokens and token](https://daily.dev/posts/revoke-a-jwt-before-it-expires-refresh-tokens-and-token-1wnroe8ld) · Milan Jovanović · 30 upvotes · 1 comments
- [Why Server-Side Sessions Break at Scale — And How JWT Fixes It](https://daily.dev/posts/why-server-side-sessions-break-at-scale-and-how-jwt-fixes-it-nm5vga0tz) · Medium · 0 upvotes · 0 comments
- [A Stolen Token Is Useless. A Stale One Still Works.](https://daily.dev/posts/a-stolen-token-is-useless-a-stale-one-still-works--1mcdf6whq) · API Evangelist · 1 upvotes · 0 comments
- [Canva Shares S3 Based Architecture for Session Revocation Across Hundreds of Millions of Sessions](https://daily.dev/posts/canva-shares-s3-based-architecture-for-session-revocation-across-hundreds-of-millions-of-sessions-lvycjnjyl) · InfoQ · 1 upvotes · 0 comments

---

Tags: [#security](https://daily.dev/tags/security), [#authentication](https://daily.dev/tags/authentication), [#authorization](https://daily.dev/tags/authorization), [#jwt](https://daily.dev/tags/jwt)

[View this post on daily.dev](https://daily.dev/posts/revoking-a-role-is-useless-if-the-session-keeps-the-old-one-iwyn0cmcg)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/revoking-a-role-is-useless-if-the-session-keeps-the-old-one-iwyn0cmcg","headline":"Revoking a role is useless if the session keeps the old one","text":"Changing a user's role in the database does not immediately revoke access if their session or JWT still carries the old role claim, since that claim can remain valid for hours. The fix is to treat role membership as live state: re-check current roles on sensitive paths, use short-lived tokens with forced re-authentication after privilege changes, and invalidate or refresh active sessions immediately on privilege downgrades.","url":"https://daily.dev/posts/revoking-a-role-is-useless-if-the-session-keeps-the-old-one-iwyn0cmcg","datePublished":"2026-09-21T06:46:04.523Z","dateModified":"2026-09-21T06:46:19.728Z","author":{"@type":"Person","name":"Auth By Example","url":"https://daily.dev/authbyexample","image":"https://media.daily.dev/image/upload/s--Fgz7IgGQ--/f_auto/v1789653205/avatars/avatar_7EADCwHmOHX0bChEhAPmt?_a=BAMAMicg0","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":60}},"interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/sources/7eadcwhmohx0bchehapmt","name":"Auth By Example"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Auth By Example","item":"https://daily.dev/sources/7eadcwhmohx0bchehapmt"},{"@type":"ListItem","position":3,"name":"Revoking a role is useless if the session keeps the old one"}]}
```

