最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Authenticate with simple rest call using feathersjs - Stack Overflow

programmeradmin3浏览0评论

I know that I can use the feathers JavaScript client lib to retrieve a security token. But I would like to use C# fronted to connect to a feathersjs backend. Is it possible to retrieve the security token using a simple rest call. I know that there is a /auth/local endpoint, but I have no idea how to use it directly.

I know that I can use the feathers JavaScript client lib to retrieve a security token. But I would like to use C# fronted to connect to a feathersjs backend. Is it possible to retrieve the security token using a simple rest call. I know that there is a /auth/local endpoint, but I have no idea how to use it directly.

Share Improve this question asked Mar 19, 2016 at 14:04 rogerglrogergl 3,7814 gold badges33 silver badges51 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

This should work from console:

curl -X POST 'http://localhost:3030/auth/local' -H 'Content-Type: application/json' --data-binary '{ "email": "<EMAIL>", "password": "<PASSWORD>" }'

One thing that's not very clear in feathersJS documentation is that the configs in default.json/production.json files actually create auth services for each field in the "auth" object. For example with config containing

 "auth": {
    "idField": "id",
    "token": {
      "secret": {...},
    "local": {},
    "facebook": {
      "clientID": "...",
      "clientSecret": "...",
      "profileFields": ["id", "name", "gender", "email", "picture.type(square).height(128).width(128)"],
      "permissions": {
        "scope": ["public_profile","email"]
      }
    },
    "google": {
      "clientID": "]...",
      "clientSecret": "...",
      "permissions": {
        "scope": ["profile"]
      }
    }
  }

You will get for free API endpoints

  /auth/local
  /auth/token
  /auth/facebook/token
  /auth/google/token

which you can call from any client (web, mobile, washing mashine)

Ok, I have to post the Json object containing email, password and type local to the the /auth/local endpoint.

发布评论

评论列表(0)

  1. 暂无评论