Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't store JWT token to cookie on REST client #676

Closed
tolyanor opened this Issue Jun 3, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@tolyanor
Copy link

tolyanor commented Jun 3, 2018

Steps to reproduce

on the server:

"cookie": { "enabled": true, "name": "feathers-jwt", "httpOnly": false, "secure": false, "domain": "localhost" }
app.use(cors({ origin: "http://localhost:8080", credentials: true }));
on the client I use axios:

Vue.axios.defaults.withCredentials = true

I make post to /authentication and receive setCookie on the response.

Set-Cookie:feathers-jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6ImFjY2VzcyJ9.eyJ1c2VySWQiOiI1YjExNGI...

After this I make POST request to a service. In this POST I see cookie:

connect.sid=s%3AC0M6oqh_TXRPffVDWDtGlCIFRugiSazV.9oo...

and receive 401 error. In the server I see:

error: NotAuthenticated: No auth token

Expected behavior

I think, I must receive code 200 in response

Actual behavior

I receive 401 no token

Module versions (especially the part that's not working):

"@feathersjs/authentication": "^2.1.6",
"@feathersjs/authentication-jwt": "^2.0.1",
"@feathersjs/authentication-local": "^1.2.1",
"@feathersjs/configuration": "^1.0.2",
"@feathersjs/errors": "^3.3.0",
"@feathersjs/express": "^1.2.2",
"@feathersjs/feathers": "^3.1.5",
"compression": "^1.7.2",
"cors": "^2.8.4",
"feathers-mongodb": "^3.1.0",
"feathers-mongoose": "^6.1.1",
"helmet": "^3.12.0",
"mongodb": "^3.1.0-beta4",
"mongoose": "^5.0.18",
"serve-favicon": "^2.5.0",
"winston": "^2.4.2"

NodeJS version:
9.3.0

Operating System:
ubuntu 14.04
Browser Version:
opera, chromium

@daffl

This comment has been minimized.

Copy link
Member

daffl commented Jun 3, 2018

Using the Feathers client you have to call app.authenticate() with no parameters as documented. No manual cookie setting or messing with session ids necessary.

@daffl daffl closed this Jun 5, 2018

@christianbs001

This comment has been minimized.

Copy link

christianbs001 commented Oct 7, 2018

@daffl I have the same problem, I'm using Vue js and as an end point /authentication but I can not read the Set-Cookie: feathers-jwt. Some suggestion is the same inconvenience I can see the token in the inspector but I can not read it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.