Closed biapar closed 4 years ago
Great question! Right now, no, but I've been thinking about that.
The only Next.js specific dependancies are:
req.cookies
helper methodreq.body
helper methodThese are very convenient but easily replaced with generic cookie/form helper functions.
I had a quick look and the methods are not used in many places:
$ git grep -n 'req.cookies'
src/lib/jwt.js:29: const cookieValue = cookieName ? req.cookies[cookieName] : req.cookies[secureCookieName] || req.cookies[insecureCookieName]
src/server/index.js:164: if (req.cookies[cookies.csrfToken.name]) {
src/server/index.js:165: const [csrfTokenValue, csrfTokenHash] = req.cookies[cookies.csrfToken.name].split('|')
src/server/index.js:190: if (req.cookies[cookies.baseUrl.name]) {
src/server/index.js:191: const [baseUrlValue, baseUrlHash] = req.cookies[cookies.baseUrl.name].split('|')
src/server/lib/callback-url-handler.js:14: const callbackUrlCookieValue = req.cookies[cookies.callbackUrl.name] || null
src/server/routes/callback.js:29: const sessionToken = req.cookies ? req.cookies[cookies.sessionToken.name] : null
src/server/routes/session.js:10: const sessionToken = req.cookies[cookies.sessionToken.name]
src/server/routes/signout.js:10: const sessionToken = req.cookies[cookies.sessionToken.name]
$ git grep -n 'req.body'
src/server/lib/oauth/callback.js:19: const body = JSON.parse(JSON.stringify(req.body))
src/server/routes/callback.js:210: const credentials = req.body
src/server/routes/signin.js:54: const email = req.body.email ? req.body.email.toLowerCase() : null
I don't actually think this would be a significant amount of work, and would be easy to maintain.
The only React specific dependancies are:
useSession()
React Hook in client<Provider>
in clientWe could easily provide a client that doesn't have these (e.g. nextauth/client/vue
).
I'm not sure what Vue.js specific functionality would be appropriate to add to the client.
Another obvious thing to follow on from this, would be to have a vanilla JavaScript client and build the whole thing as a Serverless Component
, so people can add the route to Serverless apps with a single line, but probably there are more things to do before we go there.
A vanilla JavaScript client seems to make sense though, and I'm happy to have a Vue.js specific one too if that makes sense to do.
Closing this as the question is answered.
I'm happy if anyone wants to raise this as a feature request.
It this planned as part of the @auth/core
project similar to @auth/sveltekit
?
Could it work with NuxtJS?