You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Austin2Shih
changed the title
Authentication: auth middleware + route authorization
Authentication: auth middleware
Feb 28, 2024
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).The text was updated successfully, but these errors were encountered: