n8n/packages/nodes-base/credentials/DatabricksOAuth2Api.credentials.ts
PRATHAMESH HUKKERI 6f3d2b9faa
fix(Databricks Node): Change default tokenExpiredStatusCode from 401 to 403 (#34325)
Co-authored-by: Prathamesh Hukkeri <prathamesh04@users.noreply.github.com>
2026-07-24 07:12:44 +00:00

77 lines
1.9 KiB
TypeScript

import type { ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
export class DatabricksOAuth2Api implements ICredentialType {
name = 'databricksOAuth2Api';
extends = ['oAuth2Api'];
displayName = 'Databricks OAuth2 API';
documentationUrl = 'https://docs.databricks.com/dev-tools/api/latest/authentication.html';
icon = 'file:icons/databricks.svg' as const;
properties: INodeProperties[] = [
{
displayName: 'Host',
name: 'host',
type: 'string',
default: '',
placeholder: 'https://adb-xxxxx.xx.azure.databricks.com',
required: true,
description: 'Domain of your Databricks workspace',
},
{
displayName: 'Grant Type',
name: 'grantType',
type: 'hidden',
default: 'clientCredentials',
},
{
displayName: 'Access Token URL',
name: 'accessTokenUrl',
type: 'hidden',
default: '={{$self["host"]}}/oidc/v1/token',
required: true,
},
{
displayName: 'Scope',
name: 'scope',
type: 'hidden',
default: 'all-apis',
},
{
displayName: 'Auth URI Query Parameters',
name: 'authQueryParameters',
type: 'hidden',
default: '',
},
{
displayName: 'Authentication',
name: 'authentication',
type: 'hidden',
default: 'header',
},
{
// Re-declared because the base `oAuth2Api` field is `doNotInherit`, so it
// never reaches the decrypted credential. Without it the value is always
// undefined and token refresh is hardcoded to 401 — Databricks returns 403
// when tokens expire, so the default must be 403.
displayName: 'Token Expired Status Code',
name: 'tokenExpiredStatusCode',
type: 'number',
default: 403,
description:
'HTTP status code that indicates the token has expired. Databricks returns 403 when tokens expire.',
},
];
test: ICredentialTestRequest = {
request: {
baseURL: '={{$credentials.host}}',
url: '/api/2.0/preview/scim/v2/Me',
method: 'GET',
},
};
}