5

我知道我可以使用羽毛 JavaScript 客户端库来检索安全令牌。但我想使用 C# fronted 连接到 feathersjs 后端。是否可以使用简单的休息调用来检索安全令牌。我知道有一个 /auth/local 端点,但我不知道如何直接使用它。

4

2 回答 2

5

这应该从控制台工作:

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

在 feathersJS 文档中不太清楚的一件事是 default.json/production.json 文件中的配置实际上为“auth”对象中的每个字段创建了身份验证服务。例如,配置包含

 "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"]
      }
    }
  }

您将获得免费的 API 端点

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

您可以从任何客户端(网络、移动设备、洗衣机)调用

于 2016-09-24T01:14:08.950 回答
3

好的,我必须将包含电子邮件、密码和本地类型的 Json 对象发布到 /auth/local 端点。

于 2016-03-19T14:46:07.290 回答