<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Delegated vs. Application Tokens]]></title><description><![CDATA[Delegated vs. Application Tokens]]></description><link>https://brewandbuzz.hashnode.dev</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1593680282896/kNC7E8IR4.png</url><title>Delegated vs. Application Tokens</title><link>https://brewandbuzz.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 18:41:23 GMT</lastBuildDate><atom:link href="https://brewandbuzz.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Delegated vs. Application Tokens: A Practical Guide to Entra ID & OAuth Security]]></title><description><![CDATA[When setting up identity management in Microsoft Entra ID (formerly Azure AD) or any OAuth 2.0-compliant provider, one choice impacts your security boundary more than any other: Should this request us]]></description><link>https://brewandbuzz.hashnode.dev/delegated-vs-application-tokens-a-practical-guide-to-entra-id-oauth-security</link><guid isPermaLink="true">https://brewandbuzz.hashnode.dev/delegated-vs-application-tokens-a-practical-guide-to-entra-id-oauth-security</guid><category><![CDATA[ai agents]]></category><category><![CDATA[llm]]></category><category><![CDATA[Devops]]></category><category><![CDATA[webdev]]></category><category><![CDATA[cybersecurity]]></category><category><![CDATA[AI]]></category><dc:creator><![CDATA[BrewAndBuzz Global]]></dc:creator><pubDate>Fri, 24 Jul 2026 06:45:55 GMT</pubDate><content:encoded><![CDATA[<p>When setting up identity management in Microsoft Entra ID (formerly Azure AD) or any OAuth 2.0-compliant provider, one choice impacts your security boundary more than any other: <strong>Should this request use a Delegated token or an Application token?</strong></p>
<p>Selecting the wrong token type can lead to either an exposed, over-privileged backend service or an unworkable user flow. Let's break down how each token operates under the hood, when to use them, and how to avoid identity misconfigurations.</p>
<p>Understanding the Difference
At a high level, the distinction comes down to context: Is a human actively driving the action, or is a background process running autonomously?</p>
<ol>
<li>Delegated Tokens (User Context + Application)
OAuth Flow: Authorization Code Flow with PKCE, On-Behalf-Of (OBO) Flow.</li>
</ol>
<p>How It Works: The token represents two identities simultaneously: the signed-in User and the Client Application making the call.</p>
<p>Effective Permissions: The API evaluates the intersection of what the application is allowed to do and what the user is allowed to do. If an app has Files.ReadWrite.All delegated permission, but the logged-in user only has access to folder "Marketing," the app can only access folder "Marketing."</p>
<p>Best Used For: Web applications, mobile apps, Single Page Applications (SPAs), and CLI tools where actions must strictly track back to an individual user's authorization.</p>
<ol>
<li>Application Tokens (App-Only Context)</li>
</ol>
<p>OAuth Flow: Client Credentials Grant.</p>
<p>How It Works: The token represents only the Application itself. No user is involved.</p>
<p>Effective Permissions: The token holds direct roles assigned to the application service principal. The target API grants access based purely on the application's credentials (client secret or certificate).</p>
<p>Best Used For: Background daemons, nightly sync scripts, cron jobs, event consumers, and inter-service </p>
<p>Security Pitfalls to Avoid</p>
<p>Warning: Assigning Application Permissions like DirectoryReadWrite.All or Mail.Read without restrictions gives your background service tenant-wide access. If that app's secret leaks, your entire directory is exposed.</p>
<ol>
<li><p>Over-Privileging Service Principals: If a background process only needs to read emails from a specific support inbox, don't assign Mail.Read globally via Application Permissions without scoping mechanisms like Application Access Policies in Exchange Online.</p>
</li>
<li><p>Confused Deputy Problem: Avoid using Application tokens to process requests that originated from a user UI. If User A asks your backend API to fetch a document, call Microsoft Graph using a Delegated token (or OBO flow), not an Application token. Using an Application token bypasses User A's real access controls, letting them query documents they shouldn't see.</p>
</li>
</ol>
<p>Frequently Asked Questions</p>
<p>Q: Can I use Delegated tokens for long-running, offline processes?
Yes, using OAuth 2.0 refresh_tokens or the offline_access scope. However, if the user changes their password, revokes sessions, or leaves the company, the refresh token invalidates—which is usually desired behavior for user-driven tasks.</p>
<p>Q: How do I secure Application Tokens when using Client Credentials?
Never use plain text client secrets in code repositories. Use Azure Managed Identities, AWS IAM Roles for Service Accounts (IRSA), or client certificate credentials backed by a Hardware Security Module (HSM) / Azure Key Vault.</p>
]]></content:encoded></item></channel></rss>