This template-driven authentication system consists of three main components:
- Auth Type Definitions - Master list of all supported auth types and their parameters
- Software Templates - Admin-created configurations for specific software/CRMs
- User Credentials - End-user filled values (stored at runtime)
auth-types-definition.json # Master auth types with all available options
example-software-template-*.json # Examples of what admin creates
This is your master schema that defines all possible authentication types and their configuration options.
{
"authTypes": {
"auth_type_key": {
"label": "Display Name",
"description": "What this auth type does",
"category": "simple|oauth|advanced|database",
"configOptions": {
// Options that ADMIN configures when creating software template
// These are software-specific settings
},
"credentialFields": {
// Fields that END-USER fills in when connecting
// These are user-specific credentials
},
"storedTokens": [] // For OAuth: tokens received from auth flow
}
}
}- configOptions: What the admin sees and configures in the GUI when setting up auth for a software
- credentialFields: What the end-user sees when connecting their account
- Each option has properties like:
type: string, number, boolean, array, object, jsonrequired: true/falsedefault: default valueoptions: array of allowed values (for dropdowns)locked: true means admin cannot change this valuedependsOn: shows field only if another field has specific valueexamples: example values to help adminhelpText: explanation text
When an admin adds a new software to your platform, they:
- Choose an auth type from the master list
- Fill in the config options specific to that software
- Optionally customize credential field labels to match the software's terminology
- Add any additional fields needed for that software
{
"softwareId": "unique_id",
"softwareName": "Display Name",
"baseUrl": "https://api.example.com",
"authMethods": [
{
"id": "unique_auth_method_id",
"authType": "oauth2_authorization_code", // References auth-types-definition.json
"label": "OAuth 2.0",
"isDefault": true,
"priority": 1,
"config": {
// Values for configOptions defined in auth-types-definition.json
"authorizationUrl": "https://...",
"tokenUrl": "https://...",
"scopes": ["api", "read"]
},
"credentials": {
// Customize labels for credentialFields
"clientId": {
"label": "App Key", // Custom label instead of default "Client ID"
"helpText": "Find this in settings..."
}
},
"additionalFields": [
// Any extra fields specific to this software
{
"key": "instance_url",
"label": "Instance URL",
"type": "string",
"required": false
}
]
}
]
}When admin clicks "Add Authentication Method", they see a list from auth-types-definition.json:
○ API Key (Header)
○ API Key (Query Parameter)
○ Bearer Token
○ Basic Authentication
○ Custom Headers
○ OAuth 2.0 - Authorization Code
○ OAuth 2.0 - Client Credentials
○ OAuth 2.0 - Service Account (JWT)
○ OAuth 1.0a
○ JWT
○ AWS Signature v4
○ SSH Private Key
○ Database Credentials
Let's say admin selects "OAuth 2.0 - Authorization Code"
The GUI shows fields from configOptions of that auth type:
Authorization URL: [___________________________] (required)
Example: https://accounts.google.com/o/oauth2/v2/auth
Token URL: [___________________________] (required)
Example: https://oauth2.googleapis.com/token
Scopes: [___________________________] (optional)
Example: read,write
Scope Separator: [ ▼ Space ] (dropdown: Space, Comma, Plus)
Enable PKCE: [☐]
Client Auth: [ ▼ client_secret_post ] (dropdown)
Additional Auth Params: [___________________________] (optional)
Example: {"prompt": "consent"}
Enable Token Refresh: [☑]
Refresh Token URL: [___________________________] (shown only if refresh enabled)
Admin can customize how credential fields appear to end-users:
Default Label: "Client ID"
Custom Label: [Consumer Key____________] ← Admin can rename
Help Text: [Get this from your Connected App settings...]
Placeholder: [Enter your Consumer Key...]
Result is saved as a software template (like the examples).
When an end-user wants to connect their account:
- They see the software name: "Salesforce"
- They see available auth methods: "OAuth 2.0 (Recommended)" or "Session ID"
- They select one and see credential fields:
For OAuth 2.0:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Consumer Key: [________________________]
Get this from your Salesforce Connected App settings
Consumer Secret: [************************]
Secret from your Salesforce Connected App
Instance URL: [https://login.salesforce.com]
Use https://test.salesforce.com for sandbox
[Connect Account]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- User fills in their credentials
- System executes OAuth flow based on the config
- Tokens are stored securely
Admin selects: api_key_header
Admin configures:
{
"authType": "api_key_header",
"config": {
"headerName": "Authorization",
"prefix": "Bearer "
}
}User sees:
API Key: [____________________]
System sends:
Authorization: Bearer sk_test_abc123...
Admin selects: custom_headers
Admin configures:
{
"authType": "custom_headers",
"config": {
"headers": [
{"headerName": "X-API-Token", "credentialKey": "apiToken"},
{"headerName": "X-User-ID", "credentialKey": "userId"}
]
}
}User sees:
API Token: [____________________]
User ID: [____________________]
System sends:
X-API-Token: abc123
X-User-ID: user456
Admin selects: oauth2_authorization_code
Admin configures:
{
"authType": "oauth2_authorization_code",
"config": {
"authorizationUrl": "https://login.salesforce.com/services/oauth2/authorize",
"tokenUrl": "https://login.salesforce.com/services/oauth2/token",
"scopes": ["api", "refresh_token"],
"scopeSeparator": " "
},
"credentials": {
"clientId": {
"label": "Consumer Key" // Custom label!
}
}
}User sees:
Consumer Key: [____________________]
Consumer Secret: [____________________]
[Connect via OAuth]
System does:
- Redirects to authorization URL
- Exchanges code for tokens at token URL
- Stores access_token, refresh_token
- Uses refresh_token when access_token expires
In credentialFields:
- string: Text input
- number: Numeric input
- boolean: Checkbox
- json: Textarea for JSON (like service account files)
Input types:
- text: Plain text
- password: Masked input
- textarea: Multi-line input
- number: Numeric input
- checkbox: Boolean toggle
{
"tokenRefreshEnabled": {
"type": "boolean"
},
"refreshTokenUrl": {
"type": "string",
"dependsOn": {
"tokenRefreshEnabled": true
}
}
}Field only shows if dependency is met.
{
"prefix": {
"type": "string",
"default": "Bearer ",
"locked": true
}
}Admin cannot change locked fields (uses default).
For custom_headers, credential fields are dynamically generated based on headers configuration.
configOptions now support template variables using {{variableName}} syntax for flexible credential formatting:
{
"configOptions": {
"username": {
"type": "string",
"label": "Username Pattern",
"default": "{{apiKey}}",
"helpText": "Use {{fieldName}} for variables or static values",
"examples": ["api", "{{apiKey}}", "{{email}}/{{token}}"]
}
}
}Benefits:
- Single auth type handles multiple patterns (Freshdesk:
{{apiKey}}:X, Zendesk:{{email}}/{{token}}, etc.) - Auto-detection: templates parsed if
{{present, static values used as-is - Eliminates need for separate auth types per pattern
- Self-documenting configuration
See: AUTHENTICATION-TEMPLATE-VARIABLES.md for complete documentation.
| Component | Purpose | Created By | Used By |
|---|---|---|---|
auth-types-definition.json |
Master schema of all auth types | Developers | Admin GUI |
| Software Template | Configuration for specific software | Admin | Runtime system |
| User Credentials | Actual authentication values | End-user | API requests |
Flow:
Developer creates auth-types-definition.json
↓
Admin selects auth type from master list
↓
Admin configures software-specific settings
↓
System generates form based on credentialFields
↓
End-user fills in credentials
↓
System makes authenticated API requests