diff --git a/docs/register-provider.md b/docs/register-provider.md index 597c97e2..4b92c74a 100644 --- a/docs/register-provider.md +++ b/docs/register-provider.md @@ -18,9 +18,9 @@ Perform a **web search** to determine what authentication methods the target ser --- -## Step 2: Write the provider JSON +## Step 2: Write the provider JSON (or JSONC) -Create a `.json` file using one of the templates below. +Create a `.json` or `.jsonc` file using one of the templates below. JSONC files support `//` line comments and `/* */` block comments, which is useful for documenting non-obvious field choices. ### Template A — OAuth2 Provider @@ -31,6 +31,7 @@ Create a `.json` file using one of the templates below. "display_name": "", "description": "Short description shown in the dashboard.", "logo": "https://example.com/logo.svg", + "type": "app", "auth_type": "oauth2", "flow": "dcr_pkce", "api_url": "https://example.com", @@ -70,6 +71,7 @@ Create a `.json` file using one of the templates below. "display_name": "", "description": "Short description shown in the dashboard.", "logo": "https://example.com/logo.svg", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.example.com", @@ -98,6 +100,7 @@ Create a `.json` file using one of the templates below. | `display_name` | Human-readable name (e.g., `"GitHub"`). | | `description` | Optional short dashboard description. | | `logo` | Optional logo URL shown in the dashboard. If omitted or unreachable, the dashboard falls back to provider initials. | +| `type` | **Recommended.** Provider category: `"app"`, `"llm"`, or `"mcp"`. Used to filter and display providers by category. | | `auth_type` | `"oauth2"` or `"api_key"`. | | `flow` | Default flow. See flow selection guide below. | | `api_url` | **Recommended.** The API host for proxy routing (e.g., `"api.openai.com"`). Can be a bare host, a full URL, or a host regex prefixed with `regex:` (e.g., `"regex:^api[0-9]+\\.github\\.com$"`). | diff --git a/src/authsome/__init__.py b/src/authsome/__init__.py index ae168d79..570c89c8 100644 --- a/src/authsome/__init__.py +++ b/src/authsome/__init__.py @@ -18,7 +18,7 @@ from loguru import logger as _logger from authsome.auth.models.connection import ConnectionRecord, Sensitive -from authsome.auth.models.enums import AuthType, ConnectionStatus, ExportFormat, FlowType +from authsome.auth.models.enums import AuthType, ConnectionStatus, ExportFormat, FlowType, ProviderType from authsome.auth.models.provider import ProviderDefinition from authsome.errors import ( AuthenticationFailedError, @@ -56,6 +56,7 @@ "ExportFormat", "FlowType", "ProviderDefinition", + "ProviderType", "Sensitive", # Errors "AuthsomeError", diff --git a/src/authsome/auth/bundled_providers/__init__.py b/src/authsome/auth/bundled_providers/__init__.py index 7add9a00..b592eb00 100644 --- a/src/authsome/auth/bundled_providers/__init__.py +++ b/src/authsome/auth/bundled_providers/__init__.py @@ -1,3 +1 @@ """Bundled provider definitions package for authsome.""" - -# TODO: Bundled provider definitions can be jsonc - so we can add comments diff --git a/src/authsome/auth/bundled_providers/ahrefs.json b/src/authsome/auth/bundled_providers/ahrefs.json index 60182fd2..7e9ae07e 100644 --- a/src/authsome/auth/bundled_providers/ahrefs.json +++ b/src/authsome/auth/bundled_providers/ahrefs.json @@ -4,6 +4,7 @@ "display_name": "Ahrefs", "logo": "img.logo.dev/name/ahrefs", "description": "SEO intelligence, backlink analysis, and keyword research APIs.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.ahrefs.com", diff --git a/src/authsome/auth/bundled_providers/apollo.json b/src/authsome/auth/bundled_providers/apollo.json index 0b54ccef..50671ac7 100644 --- a/src/authsome/auth/bundled_providers/apollo.json +++ b/src/authsome/auth/bundled_providers/apollo.json @@ -4,6 +4,7 @@ "display_name": "Apollo", "logo": "img.logo.dev/name/apollo", "description": "Sales intelligence and prospecting data for go-to-market workflows.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.apollo.io", diff --git a/src/authsome/auth/bundled_providers/ashby.json b/src/authsome/auth/bundled_providers/ashby.json index 118a0660..0d8bddbc 100644 --- a/src/authsome/auth/bundled_providers/ashby.json +++ b/src/authsome/auth/bundled_providers/ashby.json @@ -4,6 +4,7 @@ "display_name": "Ashby", "logo": "img.logo.dev/name/ashby", "description": "Recruiting operations, candidate data, and hiring workflow automation.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.ashbyhq.com", diff --git a/src/authsome/auth/bundled_providers/atlassian.json b/src/authsome/auth/bundled_providers/atlassian.json index 9065d15a..d7db6bd8 100644 --- a/src/authsome/auth/bundled_providers/atlassian.json +++ b/src/authsome/auth/bundled_providers/atlassian.json @@ -4,6 +4,7 @@ "display_name": "Atlassian", "logo": "img.logo.dev/name/atlassian", "description": "Jira and Atlassian workspace APIs for project and issue management.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "api.atlassian.com", diff --git a/src/authsome/auth/bundled_providers/beehiiv.json b/src/authsome/auth/bundled_providers/beehiiv.json index 27339ddb..e81cf5c0 100644 --- a/src/authsome/auth/bundled_providers/beehiiv.json +++ b/src/authsome/auth/bundled_providers/beehiiv.json @@ -4,6 +4,7 @@ "display_name": "Beehiiv", "logo": "img.logo.dev/name/beehiiv", "description": "Newsletter publishing, subscribers, and audience growth automation.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.beehiiv.com", diff --git a/src/authsome/auth/bundled_providers/brevo.json b/src/authsome/auth/bundled_providers/brevo.json index d9bffdd4..c4251eeb 100644 --- a/src/authsome/auth/bundled_providers/brevo.json +++ b/src/authsome/auth/bundled_providers/brevo.json @@ -4,6 +4,7 @@ "display_name": "Brevo", "logo": "img.logo.dev/name/brevo", "description": "Email marketing, transactional messaging, and contact management APIs.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.brevo.com", diff --git a/src/authsome/auth/bundled_providers/buffer.json b/src/authsome/auth/bundled_providers/buffer.json index 13a88ead..5553e979 100644 --- a/src/authsome/auth/bundled_providers/buffer.json +++ b/src/authsome/auth/bundled_providers/buffer.json @@ -4,6 +4,7 @@ "display_name": "Buffer", "logo": "img.logo.dev/name/buffer", "description": "Social scheduling and publishing workflows for connected channels.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.bufferapp.com", diff --git a/src/authsome/auth/bundled_providers/calendly.json b/src/authsome/auth/bundled_providers/calendly.json index a45857cb..0dcc4789 100644 --- a/src/authsome/auth/bundled_providers/calendly.json +++ b/src/authsome/auth/bundled_providers/calendly.json @@ -4,6 +4,7 @@ "display_name": "Calendly", "logo": "img.logo.dev/name/calendly", "description": "Scheduling links, events, invitees, and calendar booking automation.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.calendly.com", diff --git a/src/authsome/auth/bundled_providers/clearbit.json b/src/authsome/auth/bundled_providers/clearbit.json index 90ac244f..450b4768 100644 --- a/src/authsome/auth/bundled_providers/clearbit.json +++ b/src/authsome/auth/bundled_providers/clearbit.json @@ -4,6 +4,7 @@ "display_name": "Clearbit", "logo": "img.logo.dev/name/clearbit", "description": "Company and contact enrichment data for sales and marketing workflows.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.clearbit.com", diff --git a/src/authsome/auth/bundled_providers/cloudflare.json b/src/authsome/auth/bundled_providers/cloudflare.json index 6d3b470c..1900cd67 100644 --- a/src/authsome/auth/bundled_providers/cloudflare.json +++ b/src/authsome/auth/bundled_providers/cloudflare.json @@ -4,6 +4,7 @@ "display_name": "Cloudflare", "logo": "img.logo.dev/name/cloudflare", "description": "Cloudflare API token access for managing zones, DNS, Workers, and account resources.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "https://api.cloudflare.com/client/v4", diff --git a/src/authsome/auth/bundled_providers/confluence.json b/src/authsome/auth/bundled_providers/confluence.json index a62fdb5e..d610f576 100644 --- a/src/authsome/auth/bundled_providers/confluence.json +++ b/src/authsome/auth/bundled_providers/confluence.json @@ -4,6 +4,7 @@ "display_name": "Confluence", "logo": "img.logo.dev/name/confluence", "description": "Confluence Cloud access for reading and writing pages, spaces, and content via the Confluence REST API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://api.atlassian.com/ex/confluence", diff --git a/src/authsome/auth/bundled_providers/discord.json b/src/authsome/auth/bundled_providers/discord.json index 6b94e640..f78bb104 100644 --- a/src/authsome/auth/bundled_providers/discord.json +++ b/src/authsome/auth/bundled_providers/discord.json @@ -4,6 +4,7 @@ "display_name": "Discord", "logo": "img.logo.dev/name/discord", "description": "Discord identity, guild, and messaging integrations over OAuth.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "discord.com", diff --git a/src/authsome/auth/bundled_providers/dub.json b/src/authsome/auth/bundled_providers/dub.json index a263d606..6d6cf1fc 100644 --- a/src/authsome/auth/bundled_providers/dub.json +++ b/src/authsome/auth/bundled_providers/dub.json @@ -4,6 +4,7 @@ "display_name": "Dub.co", "logo": "img.logo.dev/name/dub", "description": "Short links, conversion tracking, and link analytics from Dub.co.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.dub.co", diff --git a/src/authsome/auth/bundled_providers/g2.json b/src/authsome/auth/bundled_providers/g2.json index b702b4fd..f06d0c0d 100644 --- a/src/authsome/auth/bundled_providers/g2.json +++ b/src/authsome/auth/bundled_providers/g2.json @@ -4,6 +4,7 @@ "display_name": "G2", "logo": "img.logo.dev/name/g2", "description": "Review, buyer intent, and marketplace data from G2.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.g2.com", diff --git a/src/authsome/auth/bundled_providers/github.json b/src/authsome/auth/bundled_providers/github.json index 555bcce1..ac42f72a 100644 --- a/src/authsome/auth/bundled_providers/github.json +++ b/src/authsome/auth/bundled_providers/github.json @@ -4,6 +4,7 @@ "display_name": "GitHub", "logo": "img.logo.dev/name/github", "description": "Connect GitHub to manage repositories, pull requests, users, and developer automation with vault-backed credentials.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": [ diff --git a/src/authsome/auth/bundled_providers/gitlab.json b/src/authsome/auth/bundled_providers/gitlab.json index 5801be2c..2022bd82 100644 --- a/src/authsome/auth/bundled_providers/gitlab.json +++ b/src/authsome/auth/bundled_providers/gitlab.json @@ -4,6 +4,7 @@ "display_name": "GitLab", "logo": "img.logo.dev/name/gitlab", "description": "GitLab repositories, user data, and project automation over OAuth.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "gitlab.com", diff --git a/src/authsome/auth/bundled_providers/google-admin.json b/src/authsome/auth/bundled_providers/google-admin.json index dcb8f5a2..bffdc3a7 100644 --- a/src/authsome/auth/bundled_providers/google-admin.json +++ b/src/authsome/auth/bundled_providers/google-admin.json @@ -4,6 +4,7 @@ "display_name": "Google Admin", "logo": "img.logo.dev/name/google", "description": "Google Workspace Admin access for managing users, groups, and organizational units via the Admin SDK.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://admin.googleapis.com/admin/directory/v1", diff --git a/src/authsome/auth/bundled_providers/google-analytics.json b/src/authsome/auth/bundled_providers/google-analytics.json index 0f8e46ec..43316e0e 100644 --- a/src/authsome/auth/bundled_providers/google-analytics.json +++ b/src/authsome/auth/bundled_providers/google-analytics.json @@ -4,6 +4,7 @@ "display_name": "Google Analytics", "logo": "img.logo.dev/name/google-analytics", "description": "Google Analytics access for reading web analytics data via the Analytics Data API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://analyticsdata.googleapis.com/v1beta", diff --git a/src/authsome/auth/bundled_providers/google-calendar.json b/src/authsome/auth/bundled_providers/google-calendar.json index d201c491..94936e03 100644 --- a/src/authsome/auth/bundled_providers/google-calendar.json +++ b/src/authsome/auth/bundled_providers/google-calendar.json @@ -4,6 +4,7 @@ "display_name": "Google Calendar", "logo": "img.logo.dev/name/google-calendar", "description": "Google Calendar access for reading and managing calendar events via the Calendar API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://www.googleapis.com/calendar/v3", diff --git a/src/authsome/auth/bundled_providers/google-chat.json b/src/authsome/auth/bundled_providers/google-chat.json index fbf2bab2..f78af240 100644 --- a/src/authsome/auth/bundled_providers/google-chat.json +++ b/src/authsome/auth/bundled_providers/google-chat.json @@ -4,6 +4,7 @@ "display_name": "Google Chat", "logo": "img.logo.dev/name/google-chat", "description": "Google Chat access for sending and managing messages and spaces via the Chat API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://chat.googleapis.com/v1", diff --git a/src/authsome/auth/bundled_providers/google-classroom.json b/src/authsome/auth/bundled_providers/google-classroom.json index c7e7fc93..dfba1ed9 100644 --- a/src/authsome/auth/bundled_providers/google-classroom.json +++ b/src/authsome/auth/bundled_providers/google-classroom.json @@ -4,6 +4,7 @@ "display_name": "Google Classroom", "logo": "img.logo.dev/name/google-classroom", "description": "Google Classroom access for managing courses, assignments, and student rosters via the Classroom API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://classroom.googleapis.com/v1", diff --git a/src/authsome/auth/bundled_providers/google-docs.json b/src/authsome/auth/bundled_providers/google-docs.json index 1e602194..59f3c2d9 100644 --- a/src/authsome/auth/bundled_providers/google-docs.json +++ b/src/authsome/auth/bundled_providers/google-docs.json @@ -4,6 +4,7 @@ "display_name": "Google Docs", "logo": "img.logo.dev/name/google-docs", "description": "Google Docs access for reading and editing documents via the Docs API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://docs.googleapis.com/v1", diff --git a/src/authsome/auth/bundled_providers/google-drive.json b/src/authsome/auth/bundled_providers/google-drive.json index 85d29709..4e9ca82b 100644 --- a/src/authsome/auth/bundled_providers/google-drive.json +++ b/src/authsome/auth/bundled_providers/google-drive.json @@ -4,6 +4,7 @@ "display_name": "Google Drive", "logo": "img.logo.dev/name/google-drive", "description": "Google Drive access for managing files and folders via the Drive API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://www.googleapis.com/drive/v3", diff --git a/src/authsome/auth/bundled_providers/google-forms.json b/src/authsome/auth/bundled_providers/google-forms.json index 6a707758..7b83d535 100644 --- a/src/authsome/auth/bundled_providers/google-forms.json +++ b/src/authsome/auth/bundled_providers/google-forms.json @@ -4,6 +4,7 @@ "display_name": "Google Forms", "logo": "img.logo.dev/name/google-forms", "description": "Google Forms access for creating forms and reading responses via the Forms API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://forms.googleapis.com/v1", diff --git a/src/authsome/auth/bundled_providers/google-gmail.json b/src/authsome/auth/bundled_providers/google-gmail.json index 10200bcc..944621a0 100644 --- a/src/authsome/auth/bundled_providers/google-gmail.json +++ b/src/authsome/auth/bundled_providers/google-gmail.json @@ -4,6 +4,7 @@ "display_name": "Gmail", "logo": "img.logo.dev/name/gmail", "description": "Gmail access for reading, composing, and managing email via the Gmail API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://gmail.googleapis.com/gmail/v1", diff --git a/src/authsome/auth/bundled_providers/google-meet.json b/src/authsome/auth/bundled_providers/google-meet.json index 148fc13e..589d5f96 100644 --- a/src/authsome/auth/bundled_providers/google-meet.json +++ b/src/authsome/auth/bundled_providers/google-meet.json @@ -4,6 +4,7 @@ "display_name": "Google Meet", "logo": "img.logo.dev/name/google-meet", "description": "Google Meet access for creating and managing video meeting spaces via the Meet REST API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://meet.googleapis.com/v2", diff --git a/src/authsome/auth/bundled_providers/google-photos.json b/src/authsome/auth/bundled_providers/google-photos.json index 8a77278f..83e582b7 100644 --- a/src/authsome/auth/bundled_providers/google-photos.json +++ b/src/authsome/auth/bundled_providers/google-photos.json @@ -4,6 +4,7 @@ "display_name": "Google Photos", "logo": "img.logo.dev/name/google-photos", "description": "Google Photos access for reading and managing photo libraries via the Photos Library API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://photoslibrary.googleapis.com/v1", diff --git a/src/authsome/auth/bundled_providers/google-search-console.json b/src/authsome/auth/bundled_providers/google-search-console.json index 737a2be0..e4050cbc 100644 --- a/src/authsome/auth/bundled_providers/google-search-console.json +++ b/src/authsome/auth/bundled_providers/google-search-console.json @@ -4,6 +4,7 @@ "display_name": "Google Search Console", "logo": "img.logo.dev/name/google-search-console", "description": "Google Search Console access for reading search analytics and sitemaps via the Search Console API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://searchconsole.googleapis.com/v1", diff --git a/src/authsome/auth/bundled_providers/google-sheets.json b/src/authsome/auth/bundled_providers/google-sheets.json index 1f33a96b..4e5c3239 100644 --- a/src/authsome/auth/bundled_providers/google-sheets.json +++ b/src/authsome/auth/bundled_providers/google-sheets.json @@ -4,6 +4,7 @@ "display_name": "Google Sheets", "logo": "img.logo.dev/name/google-sheets", "description": "Google Sheets access for reading and editing spreadsheets via the Sheets API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://sheets.googleapis.com/v4", diff --git a/src/authsome/auth/bundled_providers/google-slides.json b/src/authsome/auth/bundled_providers/google-slides.json index 4f98d551..8a9b98ed 100644 --- a/src/authsome/auth/bundled_providers/google-slides.json +++ b/src/authsome/auth/bundled_providers/google-slides.json @@ -4,6 +4,7 @@ "display_name": "Google Slides", "logo": "img.logo.dev/name/google-slides", "description": "Google Slides access for reading and editing presentations via the Slides API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://slides.googleapis.com/v1", diff --git a/src/authsome/auth/bundled_providers/google-tasks.json b/src/authsome/auth/bundled_providers/google-tasks.json index 3d0d3bb0..dafdc1f4 100644 --- a/src/authsome/auth/bundled_providers/google-tasks.json +++ b/src/authsome/auth/bundled_providers/google-tasks.json @@ -4,6 +4,7 @@ "display_name": "Google Tasks", "logo": "img.logo.dev/name/google-tasks", "description": "Google Tasks access for reading and managing task lists and tasks via the Tasks API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://tasks.googleapis.com/tasks/v1", diff --git a/src/authsome/auth/bundled_providers/google-vertex-ai.json b/src/authsome/auth/bundled_providers/google-vertex-ai.json index 776d9b31..0a5c316e 100644 --- a/src/authsome/auth/bundled_providers/google-vertex-ai.json +++ b/src/authsome/auth/bundled_providers/google-vertex-ai.json @@ -4,6 +4,7 @@ "display_name": "Vertex AI", "logo": "img.logo.dev/name/google-cloud", "description": "Google Vertex AI access for generative models, embeddings, and ML pipelines via the Vertex AI API.", + "type": "llm", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://us-central1-aiplatform.googleapis.com/v1", diff --git a/src/authsome/auth/bundled_providers/google-youtube.json b/src/authsome/auth/bundled_providers/google-youtube.json index c74f0ccf..993b3a0e 100644 --- a/src/authsome/auth/bundled_providers/google-youtube.json +++ b/src/authsome/auth/bundled_providers/google-youtube.json @@ -4,6 +4,7 @@ "display_name": "YouTube", "logo": "img.logo.dev/name/youtube", "description": "YouTube Data API access for managing channels, videos, playlists, and comments.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://www.googleapis.com/youtube/v3", diff --git a/src/authsome/auth/bundled_providers/google.json b/src/authsome/auth/bundled_providers/google.json index c6dcb817..44536892 100644 --- a/src/authsome/auth/bundled_providers/google.json +++ b/src/authsome/auth/bundled_providers/google.json @@ -4,6 +4,7 @@ "display_name": "Google", "logo": "img.logo.dev/name/google", "description": "Google identity and Google API access with OAuth-backed credentials.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "regex:.*googleapis.*", diff --git a/src/authsome/auth/bundled_providers/hubspot.json b/src/authsome/auth/bundled_providers/hubspot.json index 99ac53e7..f9042e3c 100644 --- a/src/authsome/auth/bundled_providers/hubspot.json +++ b/src/authsome/auth/bundled_providers/hubspot.json @@ -4,6 +4,7 @@ "display_name": "HubSpot", "logo": "img.logo.dev/name/hubspot", "description": "CRM contacts, companies, deals, owners, and HubSpot workflow data.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "api.hubapi.com", diff --git a/src/authsome/auth/bundled_providers/hunter.json b/src/authsome/auth/bundled_providers/hunter.json index ad312527..be59139b 100644 --- a/src/authsome/auth/bundled_providers/hunter.json +++ b/src/authsome/auth/bundled_providers/hunter.json @@ -4,6 +4,7 @@ "display_name": "Hunter", "logo": "img.logo.dev/name/hunter", "description": "Email discovery and verification data for outreach workflows.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.hunter.io", diff --git a/src/authsome/auth/bundled_providers/instantly.json b/src/authsome/auth/bundled_providers/instantly.json index cc17202a..70d79826 100644 --- a/src/authsome/auth/bundled_providers/instantly.json +++ b/src/authsome/auth/bundled_providers/instantly.json @@ -4,6 +4,7 @@ "display_name": "Instantly", "logo": "img.logo.dev/name/instantly", "description": "Outbound email campaign and lead management automation.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.instantly.ai", diff --git a/src/authsome/auth/bundled_providers/intercom.json b/src/authsome/auth/bundled_providers/intercom.json index 74a35dd8..01dc7fe0 100644 --- a/src/authsome/auth/bundled_providers/intercom.json +++ b/src/authsome/auth/bundled_providers/intercom.json @@ -4,6 +4,7 @@ "display_name": "Intercom", "logo": "img.logo.dev/name/intercom", "description": "Customer conversations, contacts, and support automation APIs.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.intercom.io", diff --git a/src/authsome/auth/bundled_providers/jira.json b/src/authsome/auth/bundled_providers/jira.json index b1a5bffc..17abdda3 100644 --- a/src/authsome/auth/bundled_providers/jira.json +++ b/src/authsome/auth/bundled_providers/jira.json @@ -4,6 +4,7 @@ "display_name": "Jira", "logo": "img.logo.dev/name/jira", "description": "Jira Cloud access for reading and managing issues, projects, and workflows via the Jira REST API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://api.atlassian.com/ex/jira", diff --git a/src/authsome/auth/bundled_providers/keywords-everywhere.json b/src/authsome/auth/bundled_providers/keywords-everywhere.json index 925738b8..e0d6daa1 100644 --- a/src/authsome/auth/bundled_providers/keywords-everywhere.json +++ b/src/authsome/auth/bundled_providers/keywords-everywhere.json @@ -4,6 +4,7 @@ "display_name": "Keywords Everywhere", "logo": "img.logo.dev/name/keywords-everywhere", "description": "Keyword volume, CPC, and SEO metrics for search workflows.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.keywordseverywhere.com", diff --git a/src/authsome/auth/bundled_providers/klaviyo-oauth.json b/src/authsome/auth/bundled_providers/klaviyo-oauth.json index 694bd72e..5f4fffe0 100644 --- a/src/authsome/auth/bundled_providers/klaviyo-oauth.json +++ b/src/authsome/auth/bundled_providers/klaviyo-oauth.json @@ -4,6 +4,7 @@ "display_name": "Klaviyo (OAuth)", "logo": "img.logo.dev/name/klaviyo", "description": "OAuth access for Klaviyo app integrations and account APIs.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "a.klaviyo.com", diff --git a/src/authsome/auth/bundled_providers/klaviyo.json b/src/authsome/auth/bundled_providers/klaviyo.json index 7e233a94..62669ff9 100644 --- a/src/authsome/auth/bundled_providers/klaviyo.json +++ b/src/authsome/auth/bundled_providers/klaviyo.json @@ -4,6 +4,7 @@ "display_name": "Klaviyo", "logo": "img.logo.dev/name/klaviyo", "description": "Klaviyo profiles, campaigns, and marketing automation API access.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "a.klaviyo.com", diff --git a/src/authsome/auth/bundled_providers/lemlist.json b/src/authsome/auth/bundled_providers/lemlist.json index c11bcb5c..0001056a 100644 --- a/src/authsome/auth/bundled_providers/lemlist.json +++ b/src/authsome/auth/bundled_providers/lemlist.json @@ -4,6 +4,7 @@ "display_name": "Lemlist", "logo": "img.logo.dev/name/lemlist", "description": "Cold outreach campaigns, leads, and email engagement workflows.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.lemlist.com", diff --git a/src/authsome/auth/bundled_providers/linear.json b/src/authsome/auth/bundled_providers/linear.json index 2d403b14..662914f7 100644 --- a/src/authsome/auth/bundled_providers/linear.json +++ b/src/authsome/auth/bundled_providers/linear.json @@ -4,6 +4,7 @@ "display_name": "Linear", "logo": "img.logo.dev/name/linear", "description": "Issues, teams, projects, and product operations through Linear.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "regex:.*\\.linear\\.app", diff --git a/src/authsome/auth/bundled_providers/linkedin-browser.json b/src/authsome/auth/bundled_providers/linkedin-browser.json index 29a7b20f..bfc75b59 100644 --- a/src/authsome/auth/bundled_providers/linkedin-browser.json +++ b/src/authsome/auth/bundled_providers/linkedin-browser.json @@ -1,9 +1,10 @@ { "schema_version": 1, "name": "linkedin-browser", - "display_name": "LinkedIn — Browser Session", + "display_name": "LinkedIn \u2014 Browser Session", "logo": "img.logo.dev/name/linkedin", "description": "LinkedIn browser-session credentials for authenticated web workflows.", + "type": "app", "auth_type": "browser", "flow": "browser", "api_url": "regex:^(www\\.linkedin\\.com|linkedin\\.com)", diff --git a/src/authsome/auth/bundled_providers/livestorm.json b/src/authsome/auth/bundled_providers/livestorm.json index ea70cb97..4f93942a 100644 --- a/src/authsome/auth/bundled_providers/livestorm.json +++ b/src/authsome/auth/bundled_providers/livestorm.json @@ -4,6 +4,7 @@ "display_name": "Livestorm", "logo": "img.logo.dev/name/livestorm", "description": "Webinar, event, registrant, and attendee data from Livestorm.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.livestorm.co", diff --git a/src/authsome/auth/bundled_providers/mailchimp.json b/src/authsome/auth/bundled_providers/mailchimp.json index 6f311869..1eeed2b6 100644 --- a/src/authsome/auth/bundled_providers/mailchimp.json +++ b/src/authsome/auth/bundled_providers/mailchimp.json @@ -4,6 +4,7 @@ "display_name": "Mailchimp", "logo": "img.logo.dev/name/mailchimp", "description": "Audience, campaign, and marketing automation APIs from Mailchimp.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.mailchimp.com", diff --git a/src/authsome/auth/bundled_providers/mention-me.json b/src/authsome/auth/bundled_providers/mention-me.json index 25909ee5..c65ca266 100644 --- a/src/authsome/auth/bundled_providers/mention-me.json +++ b/src/authsome/auth/bundled_providers/mention-me.json @@ -4,6 +4,7 @@ "display_name": "Mention Me", "logo": "img.logo.dev/name/mention-me", "description": "Referral marketing campaigns, contacts, and Mention Me data access.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "mention-me.com", diff --git a/src/authsome/auth/bundled_providers/microsoft-calendar.json b/src/authsome/auth/bundled_providers/microsoft-calendar.json index 1719a25b..4c3b9026 100644 --- a/src/authsome/auth/bundled_providers/microsoft-calendar.json +++ b/src/authsome/auth/bundled_providers/microsoft-calendar.json @@ -4,6 +4,7 @@ "display_name": "Outlook Calendar", "logo": "img.logo.dev/name/microsoft-outlook", "description": "Outlook Calendar access for reading and managing calendar events and schedules via Microsoft Graph.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://graph.microsoft.com/v1.0/me/calendars", diff --git a/src/authsome/auth/bundled_providers/microsoft-outlook.json b/src/authsome/auth/bundled_providers/microsoft-outlook.json index 5263434b..1a8af83c 100644 --- a/src/authsome/auth/bundled_providers/microsoft-outlook.json +++ b/src/authsome/auth/bundled_providers/microsoft-outlook.json @@ -4,6 +4,7 @@ "display_name": "Microsoft Outlook", "logo": "img.logo.dev/name/microsoft-outlook", "description": "Microsoft Outlook access for reading, sending, and managing email via Microsoft Graph.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://graph.microsoft.com/v1.0/me/messages", diff --git a/src/authsome/auth/bundled_providers/microsoft-word.json b/src/authsome/auth/bundled_providers/microsoft-word.json index 6c881bcb..e47009c0 100644 --- a/src/authsome/auth/bundled_providers/microsoft-word.json +++ b/src/authsome/auth/bundled_providers/microsoft-word.json @@ -4,6 +4,7 @@ "display_name": "Microsoft Word", "logo": "img.logo.dev/name/microsoft-word", "description": "Microsoft Word document access for reading and editing .docx files stored in OneDrive and SharePoint via Microsoft Graph.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://graph.microsoft.com/v1.0/me/drive", diff --git a/src/authsome/auth/bundled_providers/microsoft.json b/src/authsome/auth/bundled_providers/microsoft.json index 369a6d3e..b8fd3876 100644 --- a/src/authsome/auth/bundled_providers/microsoft.json +++ b/src/authsome/auth/bundled_providers/microsoft.json @@ -4,6 +4,7 @@ "display_name": "Microsoft", "logo": "img.logo.dev/name/microsoft", "description": "Microsoft Graph access for mail, calendars, files, tasks, and identity.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "graph.microsoft.com", diff --git a/src/authsome/auth/bundled_providers/notion.json b/src/authsome/auth/bundled_providers/notion.json index 415a1164..5e135394 100644 --- a/src/authsome/auth/bundled_providers/notion.json +++ b/src/authsome/auth/bundled_providers/notion.json @@ -4,6 +4,7 @@ "display_name": "Notion", "logo": "img.logo.dev/name/notion", "description": "Notion workspace content and integration access over OAuth.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "api.notion.com", diff --git a/src/authsome/auth/bundled_providers/notion_dcr.json b/src/authsome/auth/bundled_providers/notion_dcr.json index 757a6afa..1bb1fc61 100644 --- a/src/authsome/auth/bundled_providers/notion_dcr.json +++ b/src/authsome/auth/bundled_providers/notion_dcr.json @@ -4,6 +4,7 @@ "display_name": "Notion (DCR)", "logo": "img.logo.dev/name/notion", "description": "Notion MCP OAuth access using dynamic client registration.", + "type": "app", "auth_type": "oauth2", "flow": "dcr_pkce", "api_url": "mcp.notion.com", diff --git a/src/authsome/auth/bundled_providers/openai.json b/src/authsome/auth/bundled_providers/openai.json index 0b3c012f..0e148112 100644 --- a/src/authsome/auth/bundled_providers/openai.json +++ b/src/authsome/auth/bundled_providers/openai.json @@ -4,6 +4,7 @@ "display_name": "OpenAI", "logo": "img.logo.dev/name/openai", "description": "OpenAI API keys for model, assistant, and platform automation.", + "type": "llm", "auth_type": "api_key", "flow": "api_key", "api_url": "api.openai.com", diff --git a/src/authsome/auth/bundled_providers/optimizely.json b/src/authsome/auth/bundled_providers/optimizely.json index 825faf88..129fc64b 100644 --- a/src/authsome/auth/bundled_providers/optimizely.json +++ b/src/authsome/auth/bundled_providers/optimizely.json @@ -4,6 +4,7 @@ "display_name": "Optimizely", "logo": "img.logo.dev/name/optimizely", "description": "Experimentation, feature flags, and Optimizely platform APIs.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.optimizely.com", diff --git a/src/authsome/auth/bundled_providers/postiz.json b/src/authsome/auth/bundled_providers/postiz.json index 0edaf746..1f6829d7 100644 --- a/src/authsome/auth/bundled_providers/postiz.json +++ b/src/authsome/auth/bundled_providers/postiz.json @@ -4,6 +4,7 @@ "display_name": "Postiz", "logo": "img.logo.dev/name/postiz", "description": "Social publishing and Postiz API access through device authorization.", + "type": "app", "auth_type": "oauth2", "flow": "device_code", "api_url": "api.postiz.com", diff --git a/src/authsome/auth/bundled_providers/postmark.json b/src/authsome/auth/bundled_providers/postmark.json index 84d0d1c9..d3c224f9 100644 --- a/src/authsome/auth/bundled_providers/postmark.json +++ b/src/authsome/auth/bundled_providers/postmark.json @@ -4,6 +4,7 @@ "display_name": "Postmark", "logo": "img.logo.dev/name/postmark", "description": "Transactional email sending and server token access from Postmark.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.postmarkapp.com", diff --git a/src/authsome/auth/bundled_providers/reddit.json b/src/authsome/auth/bundled_providers/reddit.json index 89b7b01b..a21af147 100644 --- a/src/authsome/auth/bundled_providers/reddit.json +++ b/src/authsome/auth/bundled_providers/reddit.json @@ -4,6 +4,7 @@ "display_name": "Reddit", "logo": "img.logo.dev/name/reddit", "description": "Authenticate with Reddit API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "oauth": { diff --git a/src/authsome/auth/bundled_providers/resend.json b/src/authsome/auth/bundled_providers/resend.json index 7e92eaf6..c3ba52cb 100644 --- a/src/authsome/auth/bundled_providers/resend.json +++ b/src/authsome/auth/bundled_providers/resend.json @@ -4,6 +4,7 @@ "display_name": "Resend", "logo": "img.logo.dev/name/resend", "description": "Email sending, domains, audiences, and Resend API automation.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.resend.com", diff --git a/src/authsome/auth/bundled_providers/rewardful.json b/src/authsome/auth/bundled_providers/rewardful.json index b91143ca..94bc69fa 100644 --- a/src/authsome/auth/bundled_providers/rewardful.json +++ b/src/authsome/auth/bundled_providers/rewardful.json @@ -4,6 +4,7 @@ "display_name": "Rewardful", "logo": "img.logo.dev/name/rewardful", "description": "Affiliate and referral tracking data from Rewardful.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.getrewardful.com", diff --git a/src/authsome/auth/bundled_providers/savvycal.json b/src/authsome/auth/bundled_providers/savvycal.json index 2b719e6c..845e67af 100644 --- a/src/authsome/auth/bundled_providers/savvycal.json +++ b/src/authsome/auth/bundled_providers/savvycal.json @@ -4,6 +4,7 @@ "display_name": "SavvyCal", "logo": "img.logo.dev/name/savvycal", "description": "Scheduling links, events, and availability workflows from SavvyCal.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.savvycal.com", diff --git a/src/authsome/auth/bundled_providers/semrush.json b/src/authsome/auth/bundled_providers/semrush.json index 4fa9cad6..eb1e7757 100644 --- a/src/authsome/auth/bundled_providers/semrush.json +++ b/src/authsome/auth/bundled_providers/semrush.json @@ -4,6 +4,7 @@ "display_name": "SEMrush", "logo": "img.logo.dev/name/semrush", "description": "SEO, competitive research, and search analytics from Semrush.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.semrush.com", diff --git a/src/authsome/auth/bundled_providers/sendgrid.json b/src/authsome/auth/bundled_providers/sendgrid.json index 52d7cd02..f8fc45e8 100644 --- a/src/authsome/auth/bundled_providers/sendgrid.json +++ b/src/authsome/auth/bundled_providers/sendgrid.json @@ -4,6 +4,7 @@ "display_name": "SendGrid", "logo": "img.logo.dev/name/sendgrid", "description": "SendGrid email delivery, templates, and account API access.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.sendgrid.com", diff --git a/src/authsome/auth/bundled_providers/slack.json b/src/authsome/auth/bundled_providers/slack.json index a00d2797..769df877 100644 --- a/src/authsome/auth/bundled_providers/slack.json +++ b/src/authsome/auth/bundled_providers/slack.json @@ -4,6 +4,7 @@ "display_name": "Slack", "logo": "img.logo.dev/name/slack", "description": "Slack workspace channels, chat, and collaboration workflows over OAuth.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "slack.com", diff --git a/src/authsome/auth/bundled_providers/todoist.json b/src/authsome/auth/bundled_providers/todoist.json index b80ce588..d61df2da 100644 --- a/src/authsome/auth/bundled_providers/todoist.json +++ b/src/authsome/auth/bundled_providers/todoist.json @@ -4,6 +4,7 @@ "display_name": "Todoist", "logo": "img.logo.dev/name/todoist", "description": "Todoist access for managing tasks, projects, and labels via the Todoist REST API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://api.todoist.com/rest/v2", diff --git a/src/authsome/auth/bundled_providers/tolt.json b/src/authsome/auth/bundled_providers/tolt.json index e3937a46..85e4ae6c 100644 --- a/src/authsome/auth/bundled_providers/tolt.json +++ b/src/authsome/auth/bundled_providers/tolt.json @@ -4,6 +4,7 @@ "display_name": "Tolt", "logo": "img.logo.dev/name/tolt", "description": "Affiliate tracking, partner data, and referral program automation.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.tolt.com", diff --git a/src/authsome/auth/bundled_providers/typeform.json b/src/authsome/auth/bundled_providers/typeform.json index e6998f76..78312e23 100644 --- a/src/authsome/auth/bundled_providers/typeform.json +++ b/src/authsome/auth/bundled_providers/typeform.json @@ -4,6 +4,7 @@ "display_name": "Typeform", "logo": "img.logo.dev/name/typeform", "description": "Forms, responses, and Typeform workspace automation.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.typeform.com", diff --git a/src/authsome/auth/bundled_providers/wistia.json b/src/authsome/auth/bundled_providers/wistia.json index f711c82b..cb0dfdbe 100644 --- a/src/authsome/auth/bundled_providers/wistia.json +++ b/src/authsome/auth/bundled_providers/wistia.json @@ -4,6 +4,7 @@ "display_name": "Wistia", "logo": "img.logo.dev/name/wistia", "description": "Video hosting, media analytics, and Wistia account APIs.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.wistia.com", diff --git a/src/authsome/auth/bundled_providers/x-browser.json b/src/authsome/auth/bundled_providers/x-browser.json index c15ef020..09790d54 100644 --- a/src/authsome/auth/bundled_providers/x-browser.json +++ b/src/authsome/auth/bundled_providers/x-browser.json @@ -1,9 +1,10 @@ { "schema_version": 1, "name": "x-browser", - "display_name": "X (Twitter) — Browser Session", + "display_name": "X (Twitter) \u2014 Browser Session", "logo": "img.logo.dev/name/x", "description": "X browser-session credentials for authenticated web workflows.", + "type": "app", "auth_type": "browser", "flow": "browser", "api_url": "regex:^(api\\.twitter\\.com|api\\.x\\.com|x\\.com|twitter\\.com)", diff --git a/src/authsome/auth/bundled_providers/x.json b/src/authsome/auth/bundled_providers/x.json index 48ba4d30..71a6d7e5 100644 --- a/src/authsome/auth/bundled_providers/x.json +++ b/src/authsome/auth/bundled_providers/x.json @@ -4,6 +4,7 @@ "display_name": "X (Twitter)", "logo": "img.logo.dev/name/x", "description": "X OAuth access for posts, user data, and social automation.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "api.twitter.com", diff --git a/src/authsome/auth/bundled_providers/zapier.json b/src/authsome/auth/bundled_providers/zapier.json index 01a50ac1..2b1f550c 100644 --- a/src/authsome/auth/bundled_providers/zapier.json +++ b/src/authsome/auth/bundled_providers/zapier.json @@ -4,6 +4,7 @@ "display_name": "Zapier", "logo": "img.logo.dev/name/zapier", "description": "Zapier platform API access for automation and connected workflows.", + "type": "app", "auth_type": "api_key", "flow": "api_key", "api_url": "api.zapier.com", diff --git a/src/authsome/auth/bundled_providers/zoom.json b/src/authsome/auth/bundled_providers/zoom.json index a737e4ff..d42f8f03 100644 --- a/src/authsome/auth/bundled_providers/zoom.json +++ b/src/authsome/auth/bundled_providers/zoom.json @@ -4,6 +4,7 @@ "display_name": "Zoom", "logo": "img.logo.dev/name/zoom", "description": "Zoom access for creating and managing meetings, users, and recordings via the Zoom API.", + "type": "app", "auth_type": "oauth2", "flow": "pkce", "api_url": "https://api.zoom.us/v2", diff --git a/src/authsome/auth/models/__init__.py b/src/authsome/auth/models/__init__.py index 24398bdd..0456d667 100644 --- a/src/authsome/auth/models/__init__.py +++ b/src/authsome/auth/models/__init__.py @@ -14,6 +14,7 @@ ConnectionStatus, ExportFormat, FlowType, + ProviderType, ) from authsome.auth.models.provider import ( ApiKeyConfig, @@ -35,6 +36,7 @@ "ProviderClientRecord", "ProviderDefinition", "ProviderMetadataRecord", + "ProviderType", "ProviderStateRecord", "ServerConfig", "Sensitive", diff --git a/src/authsome/auth/models/enums.py b/src/authsome/auth/models/enums.py index 4c878e91..4cab2b4a 100644 --- a/src/authsome/auth/models/enums.py +++ b/src/authsome/auth/models/enums.py @@ -31,6 +31,14 @@ class ConnectionStatus(StrEnum): INVALID = "invalid" +class ProviderType(StrEnum): + """High-level category for a provider.""" + + APP = "app" + LLM = "llm" + MCP = "mcp" + + class ExportFormat(StrEnum): """Supported credential export formats.""" diff --git a/src/authsome/auth/models/provider.py b/src/authsome/auth/models/provider.py index 51f76bd7..fe650a49 100644 --- a/src/authsome/auth/models/provider.py +++ b/src/authsome/auth/models/provider.py @@ -4,7 +4,7 @@ from pydantic import BaseModel, Field -from authsome.auth.models.enums import AuthType, FlowType +from authsome.auth.models.enums import AuthType, FlowType, ProviderType # TODO: Remove hardcoded schema versions everywhere @@ -93,6 +93,7 @@ class ProviderDefinition(BaseModel): display_name: str logo: str | None = None description: str | None = None + type: ProviderType | None = None auth_type: AuthType flow: FlowType diff --git a/src/authsome/cli/commands/provider.py b/src/authsome/cli/commands/provider.py index f4b3de04..00fa679b 100644 --- a/src/authsome/cli/commands/provider.py +++ b/src/authsome/cli/commands/provider.py @@ -1,6 +1,5 @@ """Provider CLI commands.""" -import json import pathlib import sys @@ -11,7 +10,7 @@ from authsome.auth.models.provider import ProviderDefinition from authsome.cli.context import ContextObj from authsome.cli.helpers import _validate_provider_endpoints, auth_command -from authsome.utils import format_error_code +from authsome.utils import format_error_code, parse_jsonc @click.group(name="provider") @@ -118,7 +117,7 @@ async def register(ctx_obj: ContextObj, path: str, force: bool, yes: bool) -> No sys.exit(1) try: - data = json.loads(filepath.read_text(encoding="utf-8")) + data = parse_jsonc(filepath.read_text(encoding="utf-8")) definition = ProviderDefinition.model_validate(data) endpoints_to_check = _validate_provider_endpoints(definition) diff --git a/src/authsome/server/provider_repository.py b/src/authsome/server/provider_repository.py index 93c3f8cd..fba8bf90 100644 --- a/src/authsome/server/provider_repository.py +++ b/src/authsome/server/provider_repository.py @@ -2,13 +2,13 @@ import builtins import importlib.resources -import json from loguru import logger from authsome.auth.models.provider import ProviderDefinition from authsome.errors import ProviderNotFoundError from authsome.server.store.repositories import ProviderDefinitionRepository +from authsome.utils import parse_jsonc class ProviderRepository: @@ -26,9 +26,9 @@ def _load_bundled(self) -> dict[str, ProviderDefinition]: try: files = importlib.resources.files("authsome.auth.bundled_providers") for file in files.iterdir(): - if file.name.endswith(".json"): + if file.name.endswith((".json", ".jsonc")): with file.open("r", encoding="utf-8") as handle: - definition = ProviderDefinition.model_validate(json.load(handle)) + definition = ProviderDefinition.model_validate(parse_jsonc(handle.read())) bundled[definition.name] = definition except Exception as exc: logger.warning("Error loading bundled providers: {}", exc) diff --git a/src/authsome/utils.py b/src/authsome/utils.py index 661ec825..b403b8e1 100644 --- a/src/authsome/utils.py +++ b/src/authsome/utils.py @@ -2,6 +2,7 @@ import ctypes import getpass +import json import os import re import shutil @@ -30,6 +31,23 @@ EXIT_DAEMON_UNAVAILABLE = 9 +_JSONC_STRIP_RE = re.compile(r'"(?:[^"\\]|\\.)*"|//[^\n]*|/\*.*?\*/', re.DOTALL) + + +def parse_jsonc(text: str) -> Any: + """Parse JSON with C-style comments (JSONC). + + Strips ``//`` line comments and ``/* */`` block comments before passing + to the standard JSON parser. String literals are preserved verbatim so + comment-like sequences inside quoted values are never stripped. + """ + + def _strip(m: re.Match) -> str: + return m.group(0) if m.group(0).startswith('"') else "" + + return json.loads(_JSONC_STRIP_RE.sub(_strip, text)) + + def utc_now() -> datetime: """Return the current UTC datetime.""" return datetime.now(UTC) diff --git a/uv.lock b/uv.lock index 28ec0d2d..c8a7e88d 100644 --- a/uv.lock +++ b/uv.lock @@ -162,7 +162,7 @@ wheels = [ [[package]] name = "authsome" -version = "0.6.3" +version = "0.6.4" source = { editable = "." } dependencies = [ { name = "aiosqlite" },