Skip to content
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

Create User Backend Route #9

Open
mraysu opened this issue Jan 8, 2025 · 0 comments · May be fixed by #29
Open

Create User Backend Route #9

mraysu opened this issue Jan 8, 2025 · 0 comments · May be fixed by #29
Assignees
Labels

Comments

@mraysu
Copy link
Collaborator

mraysu commented Jan 8, 2025

We want a route for the backend to handle user creation. To preserve user privacy (and to avoid phishing accusations from google), we will be more or less passing most request body fields directly to Firebase, our authentication management service of choice. Users will also require a name when creating an account. This information can be stored in mongodb and should map to a user in Firebase.

Documentation for user management
PIA Create User Routes

For your PR:

Create a POST api/users/create route

  1. Request body should require the following fields:
    a. name
    b. email
    c. password
  2. Validate that these fields exist and are properly formatted, then validate that an account with this email does not already exist in our firebase userbase.
  3. Add the user using the firebase admin auth.

Create a schema for storing other user data

Schema should have two fields:

  • name - holds the user's name given by the request body
  • _id - every mongodb document has a _id field. Normally this is generated randomly, but we can define it ourselves using the firebaseUID of the user we just created. This way we can query for user data using the uid.

For testing for the PR, printing the uid to the console and showing that it corresponds to a user in our firebase project would be appropriate. However, when you commit your final changes, make sure to remove it, so that google does not accuse us of phishing when we deploy to the staging environment.

@mraysu mraysu added bug Something isn't working task and removed bug Something isn't working labels Jan 8, 2025
@mraysu mraysu mentioned this issue Jan 8, 2025
2 tasks
@kilehsu kilehsu linked a pull request Jan 22, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants