Skip to main content

OAuth reference

This page provides reference documentation for OAuth integration with Databricks, including endpoints, driver version requirements, and sample code.

Accelerate your build with the Partner AI Dev-Kit

AI coding assistant skills that generate PWAF-compliant Databricks connectors.
Learn more · Skills on GitHub

Workspace-level OAuth endpoints

DescriptionEndpoint URL
OAuth well-known configurationhttps://{databricks-host}/oidc/.well-known/openid-configuration
OAuth token endpointhttps://{databricks-host}/oidc/v1/token
OAuth authorization endpointhttps://{databricks-host}/oidc/v1/authorize

Account-level OAuth endpoints

DescriptionEndpoint URL
AWS well-known configurationhttps://accounts.cloud.databricks.com/oidc/accounts/<account-id>/.well-known/openid-configuration
Azure well-known configurationhttps://accounts.azuredatabricks.net/oidc/accounts/<account-id>/.well-known/openid-configuration
GCP well-known configurationhttps://accounts.gcp.databricks.com/oidc/accounts/<account-id>/.well-known/openid-configuration
OAuth authorization endpointhttps://<cloud-specific-url>/oidc/accounts/<account-id>/v1/authorize
OAuth token endpointhttps://<cloud-specific-url>/oidc/accounts/<account-id>/v1/token

Token time-to-live

M2M flows:

U2M flows:

Best practices

Token persistence and caching

OAuth refresh tokens are long-lived. Persist refresh tokens to avoid requiring users to re-authenticate:

  • Store tokens per user session on the application backend
  • Scope token storage to (workspace-host, user) tuples for multi-tenant applications
  • Implement secure storage using encryption at rest
  • Handle token expiration gracefully with automatic refresh

PKCE implementation

Always use PKCE (Proof Key for Code Exchange) for U2M flows:

  1. Generate a cryptographically random code_verifier (43-128 characters)
  2. Create code_challenge as Base64URL(SHA256(code_verifier))
  3. Include code_challenge and code_challenge_method=S256 in authorization request
  4. Include code_verifier in token exchange request

Error handling

Handle common OAuth errors:

ErrorCauseResolution
invalid_grantExpired or revoked refresh tokenRe-initiate OAuth flow
invalid_clientIncorrect client credentialsVerify client ID and secret
access_deniedUser denied authorizationPrompt user to retry
invalid_scopeRequested scope not allowedCheck registered scopes

Sample code

What's next