Skip to content

Function: createAuthService() ​

createAuthService(config): AuthService

Defined in: auth/src/index.ts:65

Creates an auth service instance with the given configuration.

Parameters ​

config ​

AuthConfig

Auth service configuration

Returns ​

AuthService

Auth service with signup, login, logout, and deleteUser methods

Example ​

typescript
const authService = createAuthService({
  appwrite: {
    endpoint: APPWRITE_ENDPOINT,
    projectId: APPWRITE_PROJECT,
    apiKey: APPWRITE_KEY,
  },
  loginUrl: PUBLIC_LOGIN_URL,
  domainValidation: {
    allowedDomainsRegexp: ALLOWED_DOMAINS_REGEXP,
  },
});

// In your API route:
const token = await authService.signupWithEmail(body.email);