Documentation Index
Fetch the complete documentation index at: https://docs.agentfront.dev/llms.txt
Use this file to discover all available pages before exploring further.
Generates an @AuthProvider class with type-specific authentication logic (OAuth, API key, bearer, basic, or custom).
Usage
nx g @frontmcp/nx:auth-provider openai --project crm --type api-key
Options
| Option | Type | Default | Description |
|---|
name | string | — | Required. The name of the auth provider |
project | string | — | Required. The project to add the auth provider to |
type | oauth | api-key | bearer | basic | custom | bearer | The authentication type |
directory | string | — | Subdirectory within src/auth/ |
Generated Code by Type
API Key
Bearer
Basic
OAuth
Custom
@AuthProvider({ name: 'openai', type: 'api-key' })
export class OpenaiAuthProvider {
async headers(): Promise<Record<string, string>> {
const apiKey = process.env.OPENAI_API_KEY ?? '';
return { 'X-API-Key': apiKey };
}
}
@AuthProvider({ name: 'openai', type: 'bearer' })
export class OpenaiAuthProvider {
async headers(): Promise<Record<string, string>> {
const token = process.env.OPENAI_TOKEN ?? '';
return { Authorization: `Bearer ${token}` };
}
}
@AuthProvider({ name: 'openai', type: 'basic' })
export class OpenaiAuthProvider {
async headers(): Promise<Record<string, string>> {
const username = process.env.OPENAI_USERNAME ?? '';
const password = process.env.OPENAI_PASSWORD ?? '';
const encoded = Buffer.from(`${username}:${password}`).toString('base64');
return { Authorization: `Basic ${encoded}` };
}
}
@AuthProvider({ name: 'openai', type: 'oauth' })
export class OpenaiAuthProvider {
async headers(): Promise<Record<string, string>> {
const accessToken = ''; // TODO: implement token retrieval
return { Authorization: `Bearer ${accessToken}` };
}
async refreshToken(): Promise<void> {
// TODO: implement token refresh logic
}
}
@AuthProvider({ name: 'openai', type: 'custom' })
export class OpenaiAuthProvider {
async headers(): Promise<Record<string, string>> {
// TODO: implement custom auth headers
return {};
}
}
Environment variables follow the {CONSTANT_NAME}_{SUFFIX} pattern (e.g., OPENAI_API_KEY, OPENAI_TOKEN).