AOSSIE-Org / AOSSIE-Org/DebateAI

Issue: Fix Signup Flow (CORS Configuration & Error Handling)

Open
#213 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
84
Forks
198
Avg merge
2d 19h
Merged PRs (30d)
30

Description

### Proposal: Improve Signup Reliability & Error Feedback

**Description**
The current signup flow experiences intermittent friction during local development due to strict network policies and opaque error handling. When requests fail validation (e.g., "User already exists"), the application currently suppresses the specific reason, leading to a generic "Signup failed" state. Additionally, the backend configuration can be overly restrictive regarding origin resolution (`localhost` vs `127.0.0.1`), potentially hindering seamless connectivity.

**Proposed Changes**

#### 1. Backend Improvements (`main.go`)
* **Broaden CORS Origin Support:** Update the `AllowOrigins` list to include `http://127.0.0.1:5173` alongside `localhost`.
* *Benefit:* This ensures more robust connectivity by accommodating browsers that resolve local addresses to the loopback IP, reducing the likelihood of `403 Forbidden` network rejections.
* **Standardize Header Acceptance:** Add `Accept` and `X-Requested-With` to the `AllowHeaders` configuration.
* *Benefit:* This aligns the backend with standard browser fetch behaviors, preventing preflight failures caused by strict header whitelisting.

#### 2. Frontend Experience Enhancements (`authContext.tsx`)
* **Refine Error Parsing Logic:** Update the `signup` function to prioritize reading `data.error` from the response before falling back to `data.message`.
* *Benefit:* This exposes specific validation feedback (e.g., "Password too short", "User already exists") directly to the user, significantly improving the troubleshooting experience compared to the current generic error message.

I have already made the required changes that will make onboarding for new developers easier, and am ready to create a PR.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.