Fix#3 : Implement Firebase authentication with domain validation#47
Open
ShirshenduR wants to merge 11 commits intobsoc-bitbyte:mainfrom
Open
Fix#3 : Implement Firebase authentication with domain validation#47ShirshenduR wants to merge 11 commits intobsoc-bitbyte:mainfrom
ShirshenduR wants to merge 11 commits intobsoc-bitbyte:mainfrom
Conversation
fix(auth): Made auth using firebase and domain restriction fix: auth feat: added auth
Author
|
@ritankarsaha please review actually last pr got some issue so I made new and closed it |
Collaborator
|
Sure @ShirshenduR , will review and let you know |
Collaborator
|
don't worrt abt the linting fail, it's alright |
Author
|
@ritankarsaha @harshiill are there any issues, is this pr good? |
Sandipmandal25
suggested changes
Aug 16, 2025
Comment on lines
-1
to
-12
|
|
||
|
|
||
| # DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public" | ||
|
|
||
| # DATABASE_URL="postgresql://prisma:prisma@db:5432/exam_bud?schema=public" | ||
| DATABASE_URL="postgresql://prisma:prisma@db:5432/exam_bud_test?schema=public" | ||
| NODE_ENV=test | ||
|
|
||
| PORT=4000 | ||
|
|
||
| CLOUDINARY_URL=cloudinary://<your_api_key>:<your_api_secret>@<product_environment_name> | ||
| CLOUDINARY_PUBLIC_ID=<product_environment_name> No newline at end of file |
There was a problem hiding this comment.
why is this file deleted ? @ShirshenduR
Comment on lines
-1
to
-7
| module.exports = (req, res, next) => { | ||
| req.user = { | ||
| id: parseInt(req.header('x-user-id')) || 1, | ||
| role: req.header('x-user-role') || 'USER', | ||
| }; | ||
| next(); | ||
| }; |
There was a problem hiding this comment.
don't delete middlewares, create a separate file to add the same and remove dummy features
Comment on lines
+52
to
+54
| router.get('/me', require('../middleware/FirebaseAuth.js'), (req, res) => { | ||
| res.json({ success: true, user: req.user }); | ||
| }); |
There was a problem hiding this comment.
what is this /me route doing @ShirshenduR ?
Comment on lines
+56
to
+60
| router.post('/verify-domain', (req, res) => { | ||
| const { email } = req.body; | ||
| const isValidDomain = email?.endsWith('@iiitdmj.ac.in'); | ||
| res.json({ success: true, isValidDomain }); | ||
| }); |
There was a problem hiding this comment.
why do we need to verify the domain exactly? @ShirshenduR
Comment on lines
+7
to
+10
| admin.initializeApp({ | ||
| credential: admin.credential.cert(serviceAccount), | ||
| projectId: process.env.FIREBASE_PROJECT_ID | ||
| }); |
There was a problem hiding this comment.
provide proper env sample for the same in thje pr description @ShirshenduR
Comment on lines
+227
to
+233
| } | ||
|
|
||
| .user-avatar { | ||
| width: 40px; | ||
| height: 40px; | ||
| border-radius: 50%; | ||
| object-fit: cover; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
In this PR I have added firebase auth for and login for both via registering and also by google sign in. Add the Exam-bud-firebase.json from Firebase console and setup both frontend and backend envs. Btw I have not made protected route right now
Essential Checklist
Proof that changes are correct
Screen.Recording.2025-07-25.at.5.01.32.AM.mov
PR Pointers