-
I used to use adonuxt which worked nice but it's depreciated. So I am now trying to use nuxt.js separate with adonis backend. I am trying to make login system. These two projects run on two separate port in localhost. http://localhost:3000/ nuxt project and http://localhost:3333/ adonis project. How can I get logged in user information in nuxtServerInit? I am trying like this
and in my adonis.js I am trying
The result is always not logged in.... Any idea how to implement..... |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
You need to use jwt tokens or api tokens if you want to create a login system, on user login you receive a token that you store inside your front end cookies and on nuxtserverinit you fetch that token from cookies and verify it. |
Beta Was this translation helpful? Give feedback.
-
UPDATE I am using a very simple login system
I got a very interesting result now. So if I login using my adonis project then the logged in user information becomes available in nuxt project but I cannot get the logged in user if I login using nuxt axios UPDATE 2 So, session login works, but adonis cannot find user or loggedin user when axios is used. |
Beta Was this translation helpful? Give feedback.
-
UPDATE 3 we can get logged in user only using nuxtServerInit.. We can get the logged in user using axios.. :( |
Beta Was this translation helpful? Give feedback.
-
Solved it |
Beta Was this translation helpful? Give feedback.
-
Thank you! |
Beta Was this translation helpful? Give feedback.
Solved it
https://stackoverflow.com/questions/63087960/how-to-use-session-authentication-for-nuxt-frontend-with-adonis-backend/63088651