Skip to content
This repository was archived by the owner on Mar 22, 2022. It is now read-only.

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

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

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

tolyanor opened this issue Jun 3, 2018 · 2 comments

Comments

@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
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 as completed Jun 5, 2018
@christianbs001
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.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants