As a User
I want to create an account and log in later
so that I have my own account where I can log in from wherever I want.
Description
Acceptance Criteria
[ ] having a log in page
[ ] display log in or log out button
Tasks
[ ] install next-auth
[ ] create api route pages/api/auth/[...nextauth].js
[ ] copy the code from the NextAuth Docs in there
[ ] get GitHub keys for auth by GitHub
[ ] add keys to .env.local and Vercel
[ ] add session provider to _app.js
[ ] add a logout button to the profile page that gets the signOut method from useSession
[ ] create a component LogIn that renders a log-in button that gets the signIn method from useSession
[ ] do conditonal rendering on every page that renders the content or the LogIn component depending if there is a session or not
[ ] edit your pages/api/user/index.js that returns the logged-in user or creates a new user depending if the token already exists or not
[ ] Then fetch the user on every page where you used the logged-in user from local storage before and delete everything that has to do with the local storage. We don't need that anymore.
Value Proposition
As a User I want to create an account and log in later so that I have my own account where I can log in from wherever I want.
Description
Acceptance Criteria
Tasks
pages/api/auth/[...nextauth].js
.env.local
and Vercel_app.js
signOut
method fromuseSession
LogIn
that renders a log-in button that gets thesignIn
method fromuseSession
pages/api/user/index.js
that returns the logged-in user or creates a new user depending if the token already exists or notComplexity
L