spacenews
spacenews copied to clipboard
App remains logged in after logout.
Hi Dan,
Thanks for uploading such a great repo using nuxt and django.
I'm using this as a boilerplate for a project of mine. I think it's a great set up to decouple services.
I do have a question as I don't know if it's an issue. I've created my own pages requesting data from the backend. I would only like the data to be visible if the user is authenticated. I've set this up and I do receive a 401 error in my nuxt logs (not authenticated) but the data is still displayed on the webpage.
I see that in the default page for navbar that the logout function is set like @click.prevent='logout()'
I've changed this to run logout() but I don't think the session tokens are destroyed on logout.
Is there any way you could suggest I can check if the authentication is working properly?
Below are my logs. Thanks
DONE Compiled successfully in -9552ms9:37:58 PM
2020-01-08T21:38:02.996Z nuxt:render Rendering url /monitor nuxtServerInit undefined [HPM] GET /api/events/ -> http://django:8000/api 2020-01-08T21:38:03.520Z nuxt:render Data fetching /monitor: 64ms nuxtServerInit undefined 2020-01-08T21:38:07.164Z nuxt:render Rendering url /monitor [HPM] GET /api/events/ -> http://django:8000/api 2020-01-08T21:38:07.200Z nuxt:render Data fetching /monitor: 33ms 2020-01-08T21:38:10.434Z nuxt:render Rendering url /monitor nuxtServerInit undefined [HPM] GET /api/events/ -> http://django:8000/api 2020-01-08T21:38:10.468Z nuxt:render Data fetching /monitor: 32ms 2020-01-09T08:22:19.497Z nuxt:render Rendering url /monitor nuxtServerInit undefined [HPM] GET /api/events/ -> http://django:8000/api 2020-01-09T08:22:19.563Z nuxt:render Data fetching /monitor: 58ms nuxtServerInit undefined 2020-01-09T08:22:23.371Z nuxt:render Rendering url /monitor [HPM] GET /api/events/ -> http://django:8000/api 2020-01-09T08:22:23.424Z nuxt:render Data fetching /monitor: 50ms 2020-01-09T08:22:26.512Z nuxt:render Rendering url /monitor nuxtServerInit undefined [HPM] GET /api/events/ -> http://django:8000/api 2020-01-09T08:22:26.545Z nuxt:render Data fetching /monitor: 31ms 2020-01-09T08:24:02.260Z nuxt:render Rendering url /monitor nuxtServerInit undefined [HPM] GET /api/events/ -> http://django:8000/api 2020-01-09T08:24:02.474Z nuxt:render Data fetching /monitor: 211ms 2020-01-09T08:24:05.816Z nuxt:render Rendering url /monitor nuxtServerInit undefined [HPM] GET /api/events/ -> http://django:8000/api 2020-01-09T08:24:05.857Z nuxt:render Data fetching /monitor: 38ms 2020-01-09T08:24:09.114Z nuxt:render Rendering url /monitor nuxtServerInit undefined [HPM] GET /api/events/ -> http://django:8000/api 2020-01-09T08:24:09.348Z nuxt:render Data fetching /monitor: 232ms 2020-01-09T08:27:18.054Z nuxt:render Rendering url /monitor nuxtServerInit undefined [HPM] GET /api/events/ -> http://django:8000/api 2020-01-09T08:27:18.090Z nuxt:render Data fetching /monitor: 34ms [HPM] GET /api/auth/me/ -> http://django:8000/api [HPM] GET /api/posts/ -> http://django:8000/api 2020-01-09T08:27:30.502Z nuxt:render Rendering url /monitor nuxtServerInit efd54859ee43032eb3a7347e94c4d084d28df320 [HPM] GET /api/auth/me/ -> http://django:8000/api [HPM] GET /api/events/ -> http://django:8000/api 2020-01-09T08:27:30.588Z nuxt:render Data fetching /monitor: 72ms
ERROR
Error: Request failed with status code 401
-
createError.js:16 createError [app]/[axios]/lib/core/createError.js:16:15
-
settle.js:18 settle [app]/[axios]/lib/core/settle.js:18:12
-
http.js:201 IncomingMessage.handleStreamEnd [app]/[axios]/lib/adapters/http.js:201:11
-
events.js:317 IncomingMessage.emit events.js:317:22
-
_stream_readable.js:1215 endReadableNT _stream_readable.js:1215:12
-
task_queues.js:84 processTicksAndRejections internal/process/task_queues.js:84:21
[HPM] GET /api/posts/ -> http://django:8000/api 2020-01-09T08:27:36.930Z nuxt:render Rendering url /monitor nuxtServerInit undefined [HPM] GET /api/events/ -> http://django:8000/api 2020-01-09T08:27:36.979Z nuxt:render Data fetching /monitor: 47ms