Files
smoothschedule/activepieces-fork/packages/pieces/community/jira-cloud/src/auth.ts
poduck 3aa7199503 Add Activepieces integration for workflow automation
- Add Activepieces fork with SmoothSchedule custom piece
- Create integrations app with Activepieces service layer
- Add embed token endpoint for iframe integration
- Create Automations page with embedded workflow builder
- Add sidebar visibility fix for embed mode
- Add list inactive customers endpoint to Public API
- Include SmoothSchedule triggers: event created/updated/cancelled
- Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 22:59:37 -05:00

66 lines
1.8 KiB
TypeScript

import {
AppConnectionValueForAuthProperty,
PieceAuth,
Property,
ShortTextProperty,
StaticPropsValue,
} from '@activepieces/pieces-framework';
import { getUsers, sendJiraRequest } from './lib/common';
import { HttpError, HttpMethod } from '@activepieces/pieces-common';
import { z } from 'zod';
import { propsValidation } from '@activepieces/pieces-common';
import { AppConnectionType } from '@activepieces/shared';
export const jiraCloudAuth = PieceAuth.CustomAuth({
description: `
You can generate your API token from:
***https://id.atlassian.com/manage-profile/security/api-tokens***
`,
required: true,
props: {
instanceUrl: Property.ShortText({
displayName: 'Instance URL',
description:
'The link of your Jira instance (e.g https://example.atlassian.net)',
required: true,
}),
email: Property.ShortText({
displayName: 'Email',
description: 'The email you use to login to Jira',
required: true,
}),
apiToken: PieceAuth.SecretText({
displayName: 'API Token',
description: 'Your Jira API Token',
required: true,
}),
},
validate: async ({ auth }) => {
try {
await propsValidation.validateZod(auth, {
instanceUrl: z.string().url(),
email: z.string().email(),
});
await sendJiraRequest({
auth: {
type: AppConnectionType.CUSTOM_AUTH,
props: auth,
},
method: HttpMethod.GET,
url: 'myself',
});
return {
valid: true,
};
} catch (e) {
const message = ((e as HttpError).response?.body as any)?.message;
return {
valid: false,
error: message ?? 'Invalid credentials',
};
}
},
});
export type JiraAuth = AppConnectionValueForAuthProperty<typeof jiraCloudAuth>;