Skip to main content
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

OptionTypeDefaultDescription
namestringRequired. The name of the auth provider
projectstringRequired. The project to add the auth provider to
typeoauth | api-key | bearer | basic | custombearerThe authentication type
directorystringSubdirectory within src/auth/

Generated Code by Type

@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 };
  }
}
Environment variables follow the {CONSTANT_NAME}_{SUFFIX} pattern (e.g., OPENAI_API_KEY, OPENAI_TOKEN).