Closed Arecsu closed 1 year ago
update to auth 2.1.1
Wow, that was really fast. Now the server gets the current user from the client :) awesome! Second problem is fixed. No errors in console.log($auth)
. It still doesn't redirect automatically for some reason, but I can manage to use the workaround. Thank you so much
I think these changes broke other functionallity: https://github.com/Teranode/nuxt-module-alternatives/issues/116
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Environment
Linux
v18.10.0
3.0.0-rc.12
0.6.1
yarn@1.22.19
vite
-
-
Build Modules:
-
Reproduction
nuxt.config.ts
middleware/auth.global.js
pages/login/index.vue
No redirect after successful login
Login goes well on the backend JWT server. But no intention of redirect at all. Happens with
globalMiddleware
andenableMiddleware
.I think I found a hint of the problem: while trying to debug the 2nd problem, I wrote
console.log($auth)
inside the same middleware file above. No visible problem in the client/browser console. But in the server, there's an error:The line 70 of
auth/dist/runtime/core/auth.mjs
the error log mentions:I can do this to handle redirect, but it's just a workaround to a serious problem, or at least that's what it seems.
Null values for $auth.user on server (SSR)
I've tried a lot of things. Proxy is configured right AFAIK. I don't know how to get the state of each user in the middleware and handle my custom protected routes in the server from there. It's always null, while in the client/browser returns the user. Same for
$auth.loggedIn
.The backend receives every request correctly from the client/browser. The console log in the server shows the proxy working for those client/browser calls:
/api/user/me -> http://127.0.0.1:1234
Can it be that the error mentioned above in the first problem is making this value to be null?
Maybe I'm calling some functions or config the wrong way. Super appreciated your help. And thank you so much for making these modules compatible with Nuxt 3! Great work