Skip to content

Authentication: auth middleware #6

@Austin2Shih

Description

@Austin2Shih
  • 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions