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

Authentication: auth middleware #6

Open
2 tasks done
Austin2Shih opened this issue Feb 23, 2024 · 1 comment
Open
2 tasks done

Authentication: auth middleware #6

Austin2Shih opened this issue Feb 23, 2024 · 1 comment
Assignees

Comments

@Austin2Shih
Copy link
Contributor

Austin2Shih commented Feb 23, 2024

  • Build out some util functions in /src/utils/authToken.ts
  • Build out createToken(data) --> {ok: bool, body: token?, error: error?} token or error are null depending on ok or not.
  • Build out verifyToken(token) --> {ok: bool, body: decodedToken?, error: error?}
  • From the middleware (right now it says something like token: req.headers.token as string. We want our middleware to be a function that takes in (req, res) => and takes the req to get cookies and have context.auth = verifyToken(token from cookie).
  • We also want our context to pass in res so we can access context.res so we can set cookies with a Login/Register mutation.
@Austin2Shih Austin2Shih changed the title Authentication: auth middleware + route authorization Authentication: auth middleware Feb 28, 2024
@random-logic
Copy link
Contributor

Submitted PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants