codingfriend1 / Feathers-Vue

A boiler plate template using Feathers with Email Verification, Vue 2 with Server Side Rendering, stylus, scss, jade, babel, webpack, ES 6-8, login form, user authorization, and SEO
MIT License
197 stars 48 forks source link

Authentication via REST? #6

Closed mfarees closed 7 years ago

mfarees commented 7 years ago

I am attempting to login via REST service (I'm using Postman for this but just converted it's request to a CURL request for sharing here),

curl -X POST \
  http://localhost:3030/api/auth/local \
  -H 'accept: application/json' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'postman-token: 24a2aa66-e4ca-b4a3-402c-f129f110a619' \
  -d 'email=johndoe%40gmail.com&password=123456&strategy=local'

But the server returns the following response, {"name":"NotFound","message":"Page not found","code":404,"className":"not-found","errors":{}}

I am able to create users, get messages, get users all by REST. But authentication just isn't working for me. What am I doing wrong?

codingfriend1 commented 7 years ago

Good question. Instead of using x-www-form-urlencoded, use the "raw" option and put in your email, password, and strategy as data.

Also use http://localhost:3030/api/authentication instead of http://localhost:3030/api/auth/local . I believe this was something that was updated in Feathers 2

mfarees commented 7 years ago

Thanks. That did the trick. I just changed the URL to http://localhost:3030/api/authentication

Thanks