-
Notifications
You must be signed in to change notification settings - Fork 58
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
Implement user authentication #56
Conversation
42d8b12
to
25523a2
Compare
src/App.tsx
Outdated
const App: React.FC = () => { | ||
const { user, setUser } = useContext(UserContext); | ||
|
||
user !== null && console.log('user is authenticated'); |
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.
Move this into useEffect
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.
the useEffect
was defined in the UserProvider
to invoke the getUser()
each time the UserProvider
mounts.
But as requested I changed it to invoke the getUser()
each time the App
mounts.
and the getUser()
has also been sent to the App
via Context. Could you let me know which way is correct/preferred?
6573c4e
to
d2de477
Compare
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.
Thank you! @Madhawa97
Purpose
The purpose of this PR is to fix #55
Goals
Implement a robust and user-friendly login mechanism that allows users to securely log in using their email and password credentials.
Approach
Implement a login mechanism that allows users to log in using their credentials (email and password) while utilizing HTTP-only Cookies for enhanced security.
Upon successful authentication, save the authenticated user's data in context. This context should be accessible from any part of the application, ensuring that user-specific information is available where needed.
Screenshots
Checklist
Related PRs
Test environment
Node v18, macOS latest, chrome latest
Learning
User Authentication, Typescript, useContext