N
Nuxt2mo ago
LordGhandi

Does nuxt-auth-utils package support jwt or cookie based authentication?

I'm building a fullstack web application with a dotnet as a backend and am using Identity as a the auth solution. The user is authenticated using either jwt token or cookie based authentication but I can't find anything in the docs suggesting that nuxt-auth-utils supporting that
3 Replies
kapa.ai
kapa.ai2mo ago
Hi @LordGhandi. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the available knowledge sources, the nuxt-auth-utils package is designed to provide session management and authentication utilities for Nuxt applications, primarily using secured and sealed cookies to store session data. The documentation and recipes focus on cookie-based session authentication, where session data is encrypted and stored in cookies managed by the module itself. This approach does not require a database for session storage and is handled internally by nuxt-auth-utils using a secret key for encryption set via the NUXT_SESSION_PASSWORD environment variable Sessions and Authentication. There is no explicit mention in the documentation or related sources about support for JWT (JSON Web Token) authentication, nor about integrating with external authentication systems like ASP.NET Identity that issue JWTs or manage their own authentication cookies. The utilities provided (such as setUserSession, requireUserSession, and useUserSession) are tailored for the module's own session management system, not for handling externally issued JWTs or cookies Sessions and Authentication. In summary:
- Cookie-based authentication: Supported, but specifically via the module's own sealed/encrypted cookies. - JWT authentication: There is no information in the knowledge sources indicating direct support for JWT-based authentication or integration with external JWT providers. If you need to integrate with a backend that uses JWT or external cookies (like ASP.NET Identity), you may need to implement custom logic or use a different authentication strategy, as nuxt-auth-utils appears focused on its own session management system and does not document support for external JWT or cookie-based authentication flows. If you need more advanced or external provider support, you might want to look into other solutions or wait for further updates from the Nuxt ecosystem Sessions and Authentication Conclusion. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@358749735323959308> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
LordGhandi
LordGhandiOP2mo ago
So essentially, I can make the server send either its own cookie or token doesn't really matter, and then in the login flow set the user session myself manually via a nuxt server endpoint? So essentially, I can make the server send either its own cookie or token doesn't really matter, and then in the login flow set the user session myself manually via a nuxt server endpoint?

Did you find this page helpful?