<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Are PATs (user or service principal)  accepted by Databricks Apps? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/are-pats-user-or-service-principal-accepted-by-databricks-apps/m-p/172917#M56688</link>
    <description>&lt;OL&gt;&lt;LI&gt;Is the 401 expected behavior, and is it documented anywhere?&lt;/LI&gt;&lt;LI&gt;Is there a supported way for an external system with only a static header to call a Databricks App?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I want to receive webhooks from an external SaaS product. The sender can only POST to a public HTTPS URL, and it has a beta feature that lets me add &lt;STRONG&gt;static custom header values&lt;/STRONG&gt;. It can’t run an OAuth flow or refresh tokens.&lt;/P&gt;&lt;P&gt;what I've tested:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;A service principal with Can USE&amp;nbsp;on the app, and an OAuth M2M secret.&amp;nbsp;Calling the app with the OAuth access token works. The request reaches my code.&lt;/LI&gt;&lt;LI&gt;A PAT for the service principal, sent&amp;nbsp;to the app URL. This returns &lt;STRONG&gt;HTTP 401&lt;/STRONG&gt; with an empty body, so the app proxy rejects it before my code runs.&lt;/LI&gt;&lt;/UL&gt;</description>
    <pubDate>Tue, 13 Oct 2026 09:09:14 GMT</pubDate>
    <dc:creator>databrickspooja</dc:creator>
    <dc:date>2026-10-13T09:09:14Z</dc:date>
    <item>
      <title>Are PATs (user or service principal)  accepted by Databricks Apps?</title>
      <link>https://community.databricks.com/t5/data-engineering/are-pats-user-or-service-principal-accepted-by-databricks-apps/m-p/172917#M56688</link>
      <description>&lt;OL&gt;&lt;LI&gt;Is the 401 expected behavior, and is it documented anywhere?&lt;/LI&gt;&lt;LI&gt;Is there a supported way for an external system with only a static header to call a Databricks App?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I want to receive webhooks from an external SaaS product. The sender can only POST to a public HTTPS URL, and it has a beta feature that lets me add &lt;STRONG&gt;static custom header values&lt;/STRONG&gt;. It can’t run an OAuth flow or refresh tokens.&lt;/P&gt;&lt;P&gt;what I've tested:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;A service principal with Can USE&amp;nbsp;on the app, and an OAuth M2M secret.&amp;nbsp;Calling the app with the OAuth access token works. The request reaches my code.&lt;/LI&gt;&lt;LI&gt;A PAT for the service principal, sent&amp;nbsp;to the app URL. This returns &lt;STRONG&gt;HTTP 401&lt;/STRONG&gt; with an empty body, so the app proxy rejects it before my code runs.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Tue, 13 Oct 2026 09:09:14 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/are-pats-user-or-service-principal-accepted-by-databricks-apps/m-p/172917#M56688</guid>
      <dc:creator>databrickspooja</dc:creator>
      <dc:date>2026-10-13T09:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Are PATs (user or service principal)  accepted by Databricks Apps?</title>
      <link>https://community.databricks.com/t5/data-engineering/are-pats-user-or-service-principal-accepted-by-databricks-apps/m-p/173090#M56698</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/266037"&gt;@databrickspooja&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, the 401 is expected: the Databricks Apps proxy only accepts OAuth access tokens, not PATs, so it rejects the request before your code runs. A static header can't hold an OAuth token either, because M2M tokens expire after about an hour. The supported pattern is a small relay in front of the app that holds the service principal's OAuth secret, gets and caches a token, and forwards the webhook.&lt;/P&gt;&lt;P&gt;Why the PAT fails&lt;/P&gt;&lt;P&gt;- PATs work for the workspace REST API, but app URLs go through the Apps auth proxy, which only accepts OAuth tokens (user U2M or service principal M2M).&lt;/P&gt;&lt;P&gt;The app docs only describe OAuth bearer tokens (M2M for external systems): &lt;A href="https://docs.databricks.com/aws/en/dev-tools/databricks-apps/connect-local" target="_blank" rel="noopener"&gt;https://docs.databricks.com/aws/en/dev-tools/databricks-apps/connect-local&lt;/A&gt;. The notebook example there even exchanges a PAT for an OAuth token first, and the MCP-on-Apps docs say outright that PATs aren't supported. So your 401 matches the documented behaviour, even if there's no single sentence saying "PATs rejected."&lt;/P&gt;&lt;P&gt;- There's no anonymous or public mode for an app, so the SaaS sender can't call it directly with only a static header.&lt;/P&gt;&lt;P&gt;You can have a relay setup something like below:&lt;/P&gt;&lt;P&gt;1. Deploy a tiny HTTPS function (AWS Lambda + function URL, Azure Function, Cloud Run or a Cloudflare Worker) as the public webhook target.&lt;/P&gt;&lt;P&gt;2. Have the SaaS send its static header (a long random shared secret) and check it in the relay. Also verify the sender's HMAC signature if it offers one.&lt;/P&gt;&lt;P&gt;3. In the relay, get an M2M token from &lt;A target="_blank" rel="noopener"&gt;https://&amp;lt;workspace-host&amp;gt;/oidc/v1/token&lt;/A&gt;&amp;nbsp;with grant_type=client_credentials&amp;amp;scope=all-apis, using the service principal's client ID and secret (stored in the cloud's secret manager). Cache the token until shortly before expires_in.&lt;/P&gt;&lt;P&gt;4. Forward the body to the app with Authorization: Bearer &amp;lt;token&amp;gt;. You've already confirmed this path reaches your code.&lt;/P&gt;&lt;P&gt;token = requests.post(f"{HOST}/oidc/v1/token",&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; auth=(CLIENT_ID, CLIENT_SECRET),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; data={"grant_type": "client_credentials", "scope": "all-apis"}).json()["access_token"]&lt;/P&gt;&lt;P&gt;requests.post(APP_URL + "/webhook", data=body,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"})&lt;/P&gt;&lt;P&gt;If the app only stores the events, consider skipping the app: let the relay write the payloads to a cloud storage path or queue and pick them up with Auto Loader or a Lakeflow pipeline. That way you don't need a long-running endpoint at all.&lt;/P&gt;&lt;P&gt;If the solution&amp;nbsp;helps, please accept it as solution so that it is helpful for other community members &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2026 00:31:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/are-pats-user-or-service-principal-accepted-by-databricks-apps/m-p/173090#M56698</guid>
      <dc:creator>SumeshKashyap</dc:creator>
      <dc:date>2026-10-14T00:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Are PATs (user or service principal)  accepted by Databricks Apps?</title>
      <link>https://community.databricks.com/t5/data-engineering/are-pats-user-or-service-principal-accepted-by-databricks-apps/m-p/173379#M56721</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/266037"&gt;@databrickspooja&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;PATs are not supported for calling Databricks Apps, and the 401 you're seeing is expected. The Apps ingress proxy only accepts OAuth tokens. A PAT will be rejected before your code ever runs, which is what you're seeing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The&amp;nbsp;&lt;/SPAN&gt;&lt;A class="du-bois-light-typography css-o1tibp" role="link" href="https://docs.databricks.com/aws/en/dev-tools/databricks-apps/auth" rel="noopener noreferrer" data-component-type="typography_link" data-component-id="codegen_webapp_js_genai_util_markdown.tsx_71" aria-disabled="false" target="_blank"&gt;Configure authorization in a Databricks app&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;page documents the supported authentication methods as OAuth U2M and OAuth M2M only.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;The&amp;nbsp;&lt;/SPAN&gt;&lt;A class="du-bois-light-typography css-o1tibp" role="link" href="https://docs.databricks.com/aws/en/dev-tools/databricks-apps/connect-local" rel="noopener noreferrer" data-component-type="typography_link" data-component-id="codegen_webapp_js_genai_util_markdown.tsx_71" aria-disabled="false" target="_blank"&gt;Connect to an API Databricks app using token authentication&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;page also describes 401 troubleshooting exclusively in terms of OAuth tokens.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;PATs are not mentioned as a supported option anywhere in the Apps auth docs.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So, to your core question about receiving webhooks from an external SaaS product that can only POST with a static header.. there is no built-in way to make that work directly against a Databricks App URL. The Apps proxy requires a valid OAuth token, and OAuth tokens expire after one hour, so a static header value won't stay valid.&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV class="du-bois-light-typography css-mdu5st" data-genai-markdown-block="true"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="du-bois-light-typography css-mdu5st" data-genai-markdown-block="true"&gt;As a workaround, try to use a lightweight proxy or gateway in front of your Databricks App.&amp;nbsp;You basically deploy a small service like Lambda if you are on AWS or Functions if you are Azure.. or even a simple API gateway endpoint that accepted the&amp;nbsp;unauthenticated or static-header-authenticated POSTs from your SaaS product. That service validates the incoming request using whatever static secret the SaaS sender provides in its custom header and thenn forwards the payload to your Databricks App using a fresh OAuth M2M token, which it obtains using a service principal's client ID and secret. The&amp;nbsp;&lt;A class="du-bois-light-typography css-o1tibp" style="background-color: #ffffff;" role="link" href="https://docs.databricks.com/aws/en/dev-tools/auth/oauth-m2m" rel="noopener noreferrer" data-component-type="typography_link" data-component-id="codegen_webapp_js_genai_util_markdown.tsx_71" aria-disabled="false" target="_blank"&gt;Databricks SDK handles token caching and refresh&lt;/A&gt;&amp;nbsp;transparently, so the gateway code is minimal.&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="du-bois-light-typography css-mdu5st" data-genai-markdown-block="true"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="du-bois-light-typography css-mdu5st" data-genai-markdown-block="true"&gt;This should help keep your Databricks App behind proper OAuth while giving the external SaaS a stable HTTPS endpoint with static credentials. The gateway is stateless and cheap to run.&lt;/DIV&gt;
&lt;DIV class="du-bois-light-typography css-mdu5st" data-genai-markdown-block="true"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="du-bois-light-typography css-mdu5st" data-genai-markdown-block="true"&gt;Hope this helps.&lt;/DIV&gt;
&lt;DIV class="du-bois-light-typography css-mdu5st" data-genai-markdown-block="true"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="du-bois-light-typography css-mdu5st" data-genai-markdown-block="true"&gt;
&lt;P class="p1"&gt;&lt;FONT size="2" color="#FF6600"&gt;&lt;STRONG&gt;&lt;I&gt;If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.&lt;/I&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;I&gt;&lt;/I&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2026 20:30:26 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/are-pats-user-or-service-principal-accepted-by-databricks-apps/m-p/173379#M56721</guid>
      <dc:creator>Ashwin_DSA</dc:creator>
      <dc:date>2026-10-14T20:30:26Z</dc:date>
    </item>
  </channel>
</rss>

