Comments (1)
I see your point - you want to attach cookies server-side instead of manually setting them on the client. This is very tricky due to the fact local
provider works with both Nuxt/non-Nuxt backends and authentication markers (cookies, etc.) greatly differ between all of them.
useCookie
is mostly used to preserve state (i.e. tokens) within the session and cookies being set on SSR is mostly a side-effect.
I agree that it's better if JS has no access to the cookie, however in that case we also have no reliable way of knowing the authentication state:
- SSR sees the cookie and says that a user is authenticated -> renders authenticated view;
- CSR hydrates but doesn't see the cookie -> hydration mismatch -> renders unauthenticated view.
Not relying on useCookie
at the client means that authentication state needs to be correctly set on the server and then transferred and preserved in memory during the session. This is of course doable but requires noticeable effort to think through and implement. I would love to hear your take on how it can be implemented using known building blocks of Nuxt (like useCookie
and useState
).
Concepts are welcome
from nuxt-auth.
Related Issues (20)
- Token and Session null when called from cachedEventHandler HOT 1
- Polish `NUXT_AUTH_ORIGIN` logic
- enableOnWindowFocus is not working with local provider!
- Add server-side access to tokens and session for the `local` and `refresh` providers
- Investigate `addDefaultCallbackUrl` not working correctly
- "refresh" strategy redirect to the login page on reload/direct link (already connected)
- engines field change in package.json a few days ago was a breaking change HOT 1
- Redirect back to requested page after authentication
- better integration with Kubernetes healthcheck HOT 2
- Role is only accessible from getServerSession on redirect and then the value is null
- Refresh Token Cookie Not Updating, Causing Invalid Token Error and Automatic Sign-Out HOT 3
- Get session data from token HOT 3
- AUTH_NO_ORIGIN even though there is auth origin.
- Cannot find package 'next-auth' when importing in server using '#auth' HOT 5
- Load `baseURL` from runtime config HOT 1
- refresh token is send with bearer
- Add headers for local strategy in SignIn
- Callback url does not work when I set custom pages
- 500 Received an instance of URLSearchParams
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuxt-auth.