-
Notifications
You must be signed in to change notification settings - Fork 0
1. Auth Routes
Abdullah bin Ammar edited this page May 20, 2025
·
1 revision
Warning
We're transitioning to University Single Sign-On (SSO),
GitHub and Google authentication are now deprecated and will soon be removed completely.
| Method | Endpoint | Description |
|---|---|---|
| GET | /auth/google | Initiates Google OAuth login. |
| GET | /google/callback | Callback after Google login. Redirects user based on first-time login. |
| GET | /auth/github | Initiates GitHub OAuth login. |
| GET | /github/callback | Callback after GitHub login. Redirects user based on first-time login. |
| GET | /login | Renders the login page (login.ejs). |
| GET | /login-failure | Displays a failure message if login fails. |
| GET | /logout | Logs out the user and destroys the session. |
| POST | (None in this file) | OAuth handles login via GET requests. |
- Authentication Supports Google & GitHub login using passport.js.
- User Creation;If a user logs in for the first time, they are in the database.
- If they log in with a new provider (Google/GitHub), the provider is linked to their existing account.
- Profile Redirection New users are sent to update-profile for additional setup.
- Existing users are redirected to profile.
- Session Handling Uses and to persist user login sessions.
- Graceful Logout ensures session destruction and user redirection to the homepage.
GET /auth/googleInitiates Google OAuth2 authentication flow.
Response:
- Redirects to Google consent screen
GET /google/callbackHandles Google OAuth2 callback.
Response:
- Redirects to
/update-profilefor new users - Redirects to
/profilefor existing users
GET /auth/githubInitiates GitHub OAuth2 authentication flow.
Response:
- Redirects to GitHub consent screen
GET /github/callbackHandles GitHub OAuth2 callback.
Response:
- Redirects to
/update-profilefor new users - Redirects to
/profilefor existing users
GET /logoutDestroys the user's session.
Response:
- Redirects to home page