marshallswain / feathers-pinia

Connect your Feathers API to the elegant data store for Vue
53 stars 22 forks source link

Local Authentication with custom usernameField not recognized #177

Open jondmoon opened 3 weeks ago

jondmoon commented 3 weeks ago

This could be due to me not understanding how it works, but I have set up a Feathers 5 API with local authentication, and set the usernameField to "username" instead of email in the config. But my Nuxt client is showing a typescript error because "username" is not in the AuthenticateData type. I couldn't figure out what I could do to get this to read the correct parameter. All I've done is created a fresh API server, added a few blank services, then built the client. I imported that client and went through the other setup pieces for Nuxt to get the authentication set up and everything seemed like it was working until I tried to actually add the authentication.

Here's the config in my API: "authentication": { "entity": "user", "service": "users", "local": { "usernameField": "username", "passwordField": "password" }, "authStrategies": [ "jwt", "local" ] }

And in my Nuxt code I have all of the boilerplate from the Nuxt setup instructions, plus this line which is where it has the error: await auth.authenticate({ strategy: 'local', username: '', password: '' })

Thanks.

jondmoon commented 2 weeks ago

I closed this because I thought it was working (which it is), but I still get type errors in VS Code. But I don't know if this is an issue with the feathers client bundler or with feathers-pinia. It all works if I ignore the type errors, but it would probably be better if that error was resolved.