Auth Endpoints
Login
File: api/login.php
Method: POST
Auth: None (this creates the token)
| Param | Type | Description |
|---|---|---|
email | string | User email |
password | string | User password |
housemateGroupId | string | Optional group to join on login |
Flow:
- Looks up user by email where
role=3(student) - Handles
temp_prefixed passwords (temporary passwords strip the prefix before verification) - Verifies password with
password_verify() - If status=1 (active), generates JWT and returns user data
- US-specific: checks moderation ratings due, review periods
- UK-specific: includes
houseSearchingfield - Returns viewing rewards, house filters, housemate group size, roomie status
Response: 200 with JWT token, user profile, filters, viewing data. 401 for invalid password, 403 for blocked account, 404 for unknown email.
Signup
File: api/signup.php
Method: POST
Auth: None
| Param | Type | Required |
|---|---|---|
name | string | Yes |
email | string | Yes |
password | string | Yes |
birthday | string | Yes |
gender | string | Yes |
city_name | string | Yes |
uni_year or grad_year | string | Yes (one required) |
phonenumber | string | No |
referal_code | string | No |
fcm_token | string | No |
picture | file | No |
billsCode | string | No (bills signup code) |
Flow:
- Validates all required fields (returns 422 for missing)
- Checks for duplicate email (returns 409)
- Uploads profile picture to S3 (or uses default)
- Hashes password with
password_hash(PASSWORD_DEFAULT) - Inserts user record
- Handles referral code if provided
- Sends welcome email via Mailgun
- Handles bills signup code if provided
- Processes pending friend invitations
- Sends FCM notification to friend who invited the user
- Returns JWT token
UK Signup
File: api/ukSignup.php
Method: POST
UK-specific signup flow. To be documented further based on actual file content.
SSO Login (US)
File: api/sso_login.php
Method: POST
Initiates SAML SSO flow via SimpleSAMLphp. Redirects to university Identity Provider. After callback, creates a temporary JWT containing SAML attributes.
SSO Auth (US)
File: api/sso_auth.php
Method: POST
Auth: Temporary JWT from SSO login
| Param | Type | Description |
|---|---|---|
jwt | string | Temporary JWT containing SAML attributes |
Flow:
- Decodes temporary JWT to extract SAML attributes
- Extracts
collegeUIDfrom SAML attributeurn:oid:1.3.6.1.4.1.9904.5.1.1.1.1 - Looks up user by
collegeUIDin users table - If first activation (no
last_seen), adds user to Mailchimp and HubSpot - Records user session
- Returns full user profile with app JWT
- Includes moderation data, review periods, viewing rewards, friend requests
SSO Dev Bypass
File: api/sso_auth_devbypass.php
Development-only SSO bypass for testing without university IdP.
Apple Sign-In
File: api/appleSignin.php
Method: POST
| Param | Type | Description |
|---|---|---|
userID | string | Apple user ID |
email | string | Apple email (first sign-in only) |
name | string | User name (first sign-in only) |
Looks up user by appleID column. If found, returns existing user data with new JWT. If not found, creates new user account.
Google Sign-In
File: api/googleSignin.php
Method: POST
Google OAuth verification using google/apiclient. Verifies the Google credential and looks up/creates user.
Facebook Sign-In
File: api/facebookSignin.php
Method: POST
Facebook authentication flow.
Send OTP
File: api/send_otp.php
Method: POST
| Param | Type | Description |
|---|---|---|
email | string | User email |
Generates a 6-digit OTP, stores it in the users table, sends via Twilio SMS to the user’s registered phone number. Returns 200 on success, 404 if email not found.
Verify OTP
File: api/verify_otp.php
Method: POST
Validates the OTP against the stored value and expiry.
Signup OTP
File: api/signUpOtp.php
Method: POST
OTP flow during signup process.
Password Reset
File: api/forgot_password_reset.php
Method: POST
File: api/password_reset.php
Method: POST
Password reset flows.
Email Check
File: api/emailCheck.php
Method: POST
Checks if an email exists in the system. Used during signup to detect duplicates early.
Check Existing User
File: api/checkExistingUser.php
Method: POST
Checks if a user exists by various identifiers.