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
Eventually the nuxt app may subsume and contain all of what used to be server and client but this is a long-range task that will require extensive refactoring of all the components etc., to use tailwindcss and nuxt abstractions and simplifications
So as a stopgap measure one direction we're exploring uses JWT tokens based on this SO question:
create JWT based on email address
deprecate api/ in favor of using server/api/
add jsonwebtoken package to generate JWTs
refs virtualcommons#806
Co-authored-by: Allen Lee <[email protected]>
Co-authored-by: sgfost <[email protected]>
chrstngyn
pushed a commit
to chrstngyn/port-of-mars
that referenced
this issue
Sep 15, 2022
Eventually the nuxt app may subsume and contain all of what used to be server and client but this is a long-range task that will require extensive refactoring of all the components etc., to use tailwindcss and nuxt abstractions and simplifications
So as a stopgap measure one direction we're exploring uses JWT tokens based on this SO question:
https://stackoverflow.com/questions/73398610/nuxt-3-jwt-authentication-using-fetch-and-pinia
and in particular this question: https://stackoverflow.com/a/73406144/93370
/server/api/login.post.ts
) that creates a fresh JWT based on an email address, e.g.,https://stackoverflow.com/questions/39810741/how-to-store-a-jwt-token-inside-an-http-only-cookie
server/middleware/setAuth.ts
) that makes accessing the authenticated user in all other api endpoints easier:authentication
keyin all nuxt server endpoints that need an auth user get it via
event.context.auth.email
or whatever we set it to in the server/middlewarelegacy server side also needs these same checks, this is probably gonna be ugly copy/paste duplication for simplicity at the moment
The text was updated successfully, but these errors were encountered: