Ashwin_DSA
Databricks Employee
Databricks Employee

Hi @databrickspooja,

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. 

The Configure authorization in a Databricks app page documents the supported authentication methods as OAuth U2M and OAuth M2M only.  The Connect to an API Databricks app using token authentication page also describes 401 troubleshooting exclusively in terms of OAuth tokens.  PATs are not mentioned as a supported option anywhere in the Apps auth docs.

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.

 
As a workaround, try to use a lightweight proxy or gateway in front of your Databricks App. 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 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 Databricks SDK handles token caching and refresh transparently, so the gateway code is minimal. 
 
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.
 
Hope this helps.
 

If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.

 

Regards,
Ashwin | Delivery Solution Architect @ Databricks
Helping you build and scale the Data Intelligence Platform.
***Opinions are my own***