feathersjs-ecosystem / feathers-vuex

Integration of FeathersJS, Vue, and Nuxt for the artisan developer

Home Page:https://vuex.feathersjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

http://prntscr.com/w77v9r

Here is the repository

https://github.com/superVoja/todo-app

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:

  1. 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.
  2. 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 👍