NotAuthenticated
superVoja opened this issue · comments
I am trying to make a Login component with Vue but I keep getting
{type: "FeathersError", name: "NotAuthenticated", message: "Invalid login", code: 401, className: "not-authenticated", …}
My Signup component is working and I see my user in my database, I'm using mongo, but when I try to login I get a 401.
Here is the error message in the browser:
Here is the repository
Hi, @superVoja. This error usually happens when you haven't called the authenticate
method before you make any API requests. I usually handle this in one of two ways:
- Use a "Gateway Component" or view, which has some type of
v-if
logic that only renders components that fetch private data when the user/app has authenticated. - Use a client-side hook that checks if the feathers client is authenticated and calls the
authenticate
action in a before hook if not authenticated.
Hi, thank you for the answer, could you point me to some code or docs on how to set up this. Thank you
Seems that I missed a very important thing,
Important: If you want to set the value of usernameField to username in your configuration file under Windows, the value has to be escaped as \username (otherwise the username environment variable will be used).
when I changed this to in the default.json it works.
Thank you for your time 👍