> For the complete documentation index, see [llms.txt](https://zakariaes-organization.gitbook.io/saascore-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zakariaes-organization.gitbook.io/saascore-docs/authentication-flow.md).

# 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).
