WSU-Software-Development-Club / WSU-Software-Development-Club/self-hosting
Register and login endpoints with cookie sessions
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Why
Every file-related feature is scoped to a user, so auth has to exist first. We're using HTTP-only session cookies rather than JWTs: they're simpler for a browser app and the browser handles sending them.
Depends on: the SQLAlchemy/Alembic issue.
Files to touch
backend/app/auth.py(new)backend/app/main.py: include the auth routerbackend/tests/test_auth.py(new)backend/requirements.txt: password hashing lib
Definition of done
-
POST /auth/registerwith{email, password}hashes the password (bcrypt or argon2) and returns 201; duplicate email returns 409 -
POST /auth/loginverifies credentials and sets an HTTP-only session cookie; bad credentials return 401 -
POST /auth/logoutclears the cookie -
GET /auth/mereturns the current user, or 401 if not logged in - A
get_current_userFastAPI dependency exists that later routes can reuse - Tests cover register, duplicate email, login, and unauthorized
/me
Hints
Never store plain-text passwords. passlib or argon2-cffi handle hashing. For sessions, a signed cookie (e.g. itsdangerous) is enough for now; a server-side session table can come later.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the planned entry points in backend/app/auth.py and backend/app/main.py, then review the SQLAlchemy/Alembic dependency before choosing the password-hashing and signed-cookie approach. Add backend/tests/test_auth.py for registration, duplicate email, login, and unauthorized /me behavior. Done means all listed endpoints, reusable get_current_user dependency, cookie handling, status codes, and tests are present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, python, sqlalchemy
- Domain
- api, authentication, backend, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100