cretueusebiu / laravel-nuxt

A Laravel-Nuxt starter kit.
https://laravel-nuxt.cretueusebiu.com
MIT License
1.15k stars 262 forks source link

Unable to log in after registration. #119

Closed panjezor closed 3 years ago

panjezor commented 4 years ago

Just to have some background. Nuxt set to SPA, both on the same hostname (changed it so that Nuxt triggers same address + /api). The page does work fine and I can move around. If I register, it will validate my requests and create an account for me to log in.

HOWEVER, if I log out, or just create a new page and try to get on the page again, I will not be able to go through /login page. Network tab told me that I succesfully got the token from /login POST, but didnt get the user from /user POST, instead it says:

error: "Already authenticated."

This message is sent by RedirectIfAuthenticated backend middleware.

What do I need to change to make it so people could log in after they register too?

rudolfbruder commented 4 years ago

Hi,

User should be automatically logged in after registration. Can you check which api calls and Vuex actions are called? Maybe in vue dev tools you can find out if the FETCH_USER action did fail?