-
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
User authentication #2
base: main
Are you sure you want to change the base?
Conversation
…install required tech stacks
…ions to work on user authentication
…gnup form directly instead works when opened on a new tab
…unt and skip for now logic in login form component
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.
Hard for me to review this one, as I'm not up to speed on vue. As far as I can tell, code looks good.
There are 1800+ files here. Do we really need to vendor our dependencies? |
@dlardo Resolved |
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.
Left you some things to consider
// Broadcast messages to all connected clients | ||
socket.on('draw', (data) => { | ||
// Store data in Redis | ||
redisClient.set('drawData', JSON.stringify(data)); |
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.
If horizontal scalability isn't a goal then I would keep the data local. Redis is going to add additional complexity without adding any benefit.
// More event handling here | ||
}); | ||
|
||
const port = 3000; |
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.
I would consider putting this into a config file or an environment variable.
const auth = getAuth(); | ||
|
||
const login = () => { | ||
signInWithEmailAndPassword(auth, email.value, password.value) |
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.
I would consider going only with Google (or other Oauth providers). Building and maintaining code, and protecting personal information and passwords is a lot of responsibility and effort. "Google says this is a person" is probably good enough for this app's needs.
|
||
// Your web app's Firebase configuration | ||
const firebaseConfig = { | ||
apiKey: "AIzaSyCY_lHHHSAjhGq7no6ETe4002WQIa5Cx7s", |
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.
This is probably fine for this project but in general you don't want to commit apiKeys, they are your app's passwords. I would consider putting this in a config file and reading the API key from it. Typically teams will use a shared secret manager like Lastpass, or use something like https://pwpush.com/ to send the secret around.
const currentUser = auth.currentUser; | ||
|
||
// Check if the route requires authentication | ||
if (to.matched.some((record) => record.meta.requiresAuth)) { |
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.
Consider rewriting this block so it's flatter (more left aligned). The else statements are almost always next();
so following the code would be better if you had a flow similar to this:
if (!auth) { go auth() };
if (!bogusUrl) { go fish() }
if (some other things that could go wrong...)
// Happy path
next();
Step 1: Set Up Firebase
Create a Firebase project:
Set up Firebase Authentication:
Get Firebase Configuration:
Step 2: Frontend Integration
Install the Firebase SDK in your Vue.js frontend:
Set up Firebase in your Vue.js app:
firebase.js
file in yoursrc
directory.Use Firebase Authentication in your Vue components:
auth
from yourfirebase.js
file and use it to manage authentication state, sign-in, sign-out, etc.Step 3: Backend Integration
Step 4: User Experience
Design and implement user registration and login interfaces in your Vue.js app.
Use Firebase authentication methods to register and sign in users.
Step 5: Testing and Deployment
Test user authentication thoroughly to ensure it's working as expected.
Deploy your Vue.js frontend and Node.js backend to your hosting provider.