# Authentication Flow

Our boilerplate supports two types of authentication systems:

1. OAuth Providers (e.g., Google, GitHub)
2. Credentials (traditional method)

### Important Functions to know&#x20;

### **setupUserAccount()**

**Location**: `actions/setup-account.ts`\
**Purpose**: Sets up the user account by:

* Assigning the user role.
* Creating the ClientPlan record.
* Calling `handleAfterSignupTasks()`.

### **handleAfterSignupTasks()**

**Location**: `actions/setup-account.ts`\
**Purpose**: Handles additional tasks post-signup:

* Adds the email to the audience list (on Resend).
* Sends a welcome email to the client.
* Sets up the NotificationPreferences table.
* Assigns a country to the user.
* Adds contact to the Affiliates database (if it’s an affiliate).
* Sends a welcome email to the affiliate (if applicable).
