-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/firebase auth #53
base: main
Are you sure you want to change the base?
Conversation
…setup frontend firebase and test SignUp page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greate work on the firebase stuff its a large task and lots of work
There is a lot of extra code that isn't called that I'm not sure we need nor certain about its purpose some i don't even think have its matching backend or is needed
Please address the comments or responde to them if any questions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this?
What additional git ignores does this do ontop of the ones already existing in the .gitignore file at the root of the repository
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package.json and package-lock.json shouldn't be needed in the root folder. Delete these two files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are using the app directory format of next js so app/login/page.tsx would result in the route /login rendering the file page.tsx. so rename and move the page to a folder called login
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment can we try to use reacthook form
if not create a type for the form and then use it as the useState
type LoginForm {
email:string;
}
...
useState
Something like that see the example given on the signup file comment
|
||
export const verifyUser = async (firebaseToken: string): Promise<APIResult<User>> => { | ||
try { | ||
const response = await GET("/user", createAuthHeader(firebaseToken)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this suposed to be the "/whoami" route?
Authorization: `Bearer ${firebaseToken}`, | ||
}); | ||
|
||
export const verifyUser = async (firebaseToken: string): Promise<APIResult<User>> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think you are calling this function let's call it on the login page after submitting the loging and getting the togen back from the usercredentials See pap's onSubmit for the login page https://github.com/TritonSE/PAP-Inventory-Processing/blob/ea2e7275d40f10fca354eb749f253a52cc75ef60/frontend/src/app/login/page.tsx#L85
email: string; | ||
profilePicture: string; | ||
lastChangedPassword: Date; | ||
archived: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats the meaning and purpose of the last two?
} | ||
}; | ||
|
||
export async function getNotApprovedUsers(firebaseToken: string): Promise<APIResult<User[]>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this purpose?
Don't think the route this thing calls is even defined?
} | ||
} | ||
|
||
export async function approveUser(email: string, firebaseToken: string): Promise<APIResult<void>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here and below purpose of approve and deny users?
): Promise<APIResult<void>> { | ||
try { | ||
const headers = createAuthHeader(firebaseToken); | ||
const response = await DELETE(`/user/delete/${encodeURIComponent(email)}`, undefined, headers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think this route is defined? even for the backend route that are commented out it doesn't match
} | ||
} | ||
|
||
type ObjectId = string; // This is a placeholder for the actual ObjectId type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are all the functions below requests to our backend?
for the photos the plane is to store in firebase and store only in our db a url to the photo. Not sure the purpose of the below functions if being sent to our db
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the purpose and use of most of these functions
Tracking Info
Resolves #2 , #9 , #35
Changes
First Issue (#2):
Set Up Firebase for User Sign/Up Flow
-- Create Backend Create User Route (Following onboarding repo conventions)
-- Backend Routes handle Firebase portions
-- Store the UID that Firebase returns to pass to MongoDB
-- Simple dummy Sign up pages to test (Put it under Frontend/src/app/pages)
Second Issue (#9):
-- Set up the frontend request to send to Firebase to login user.
Third Issue (#35):
-- API call to the backend to fetch user identity - Get the user Identity from the backend by grabbing user data from the database
-- For login, create route to authenticate the user where Backend verifies Firebase token
-- Log user out
You can use the Sign up page and Log In pages that I created to test this pull request.
Confirmation of Change
To see the change, try signing up a user and logging that user in. Then, log the user out. I may add in a master page to better test the fetching of user identity if needed.
Message me on Slack for .env files for the frontend and backend.