Comments (4)
I was able to use a fresh installation of the vue-js real world app calling a local version of the feathers-realworld-example-app without any trouble. I notice that the vue app does not seem to clear the Authorization header properly (gothinkster/vue-realworld-example-app#296 (comment)). Is it possible that a token generated by the node-express-realworld_-example-app was retained by the vue app in the Authorization header and then passed to the feathers app? This would produce the result you observed. The feathers app will return an error indicating the token is invalid (invalid signature).
from feathers-realworld-example-app.
Thanks for checking the feathers app. Here's what I've found checking the Vue app with Feathers and Node Express.
The feathers error message looks like there might be a problem in the feathers error handling because the response includes extra (redundant) stuff. The client has to grab the “errors” instead of assuming that’s all there is.
Looks like this:
{
"name": "NotAuthenticated",
"message": "Invalid login",
"code": 401,
"className": "not-authenticated",
"data": {
"message": "Invalid login"
},
"errors": {
"body": [
{
"name": "NotAuthenticated",
"code": 401,
"message": "Invalid login"
}
]
}
}
Should probably look like this:
{
"errors": {
"body": [
{
"name": "NotAuthenticated",
"code": 401,
"message": "Invalid login"
}
]
}
}
However, it looks like the Vue app does grab the “errors” value properly but doesn’t handle the “body” array properly and this is why we see body [object Object]..
The “body” array is in the spec:
Errors and Status Codes
If a request fails any validations, expect a 422 and errors in the following format:
{
"errors":{
"body": [
"can't be empty"
]
}
}
So that seems to mean that the Vue app has a problem.
A further wrinkle is that the Node Express app doesn’t include the “body” array in its error response.
{
"errors": {
"email or password": "is invalid"
}
}
And that’s why the Vue app displays a better error message when calling the Node Express app.
from feathers-realworld-example-app.
I had emailed Randy as well, and he suggested looking into the following:
The service will attempt to authenticate if an ‘Authorization’ header is present in the request (see src/hooks/authenticateif.js). Perhaps that header is present but not valid? I think the service assumes that non-authenticated access will not have an ‘Authorization’ header.
from feathers-realworld-example-app.
Thanks for looking into this Randy,
When I tried again with chromium-browser --temp-profile
the error was gone, so there was something leftover in the browser state, I should have tried that earlier.
BTW, I noticed that error reporting back to user on UI was not very correct, e.g. trying to login with a wrong username/password shows on UI:
body [object Object]
The message on the server terminal is clearer however:
error: NotAuthenticated: Invalid login
at new NotAuthenticated (/home/ciro/git/feathers-realworld-example-app/node_modules/@feathersjs/errors/lib/index.js:93:17)
at /home/ciro/git/feathers-realworld-example-app/node_modules/@feathersjs/authentication/lib/hooks/authenticate.js:87:31
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Do you know if this is a bug/missing feather here or on the Vue frontend? I might send a pull request to the relevant project later on to fix it.
Edit: tested react now, it fails on slightly different ways. So part of the problem is definitely on the frontend.
from feathers-realworld-example-app.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from feathers-realworld-example-app.