I try to do login to my application using local users kept in mongodb. My application works on Node.js using feathersjs. After run the app I receive an error like below:
Error: You must provide a 'header' in your authentication configuration or pass one explicitly
This is my config file:
{
"host": "localhost",
"port": 3030,
"public": "../public/",
"paginate": {
"default": 10,
"max": 50
},
"authentication": {
"secret": "My secret key",
"strategies": [
"jwt",
"local"
],
"path": "/authentication",
"service": "authentication",
"jwt": {
"header": {
"type": "access"
},
"audience": "https://yourdomain.com",
"subject": "anonymous",
"issuer": "feathers",
"algorithm": "HS256",
"expiresIn": "1d"
},
"local": {
"entity": "user",
"usernameField": "email",
"passwordField": "password"
}
},
"mongodb": "mongodb://localhost:27017/mydb"
}
What is wrong with this?
This was a bug in a recent version of feathers-cli
which has been fixed in v2.3.7
so make sure feathers --version
show that version. In an existing application you can fix the error message with by changing src/app.js
from
app.configure(jwt(config.jwt));
app.configure(local(config.local));
To
app.configure(jwt());
app.configure(local());