我可以从客户端(浏览器)发出这样的POST:
http://localhost:3030/authentication/
POST BODY:
{“strategy”:“local”,“email”:“myEmail”,“password”:“myPassword”}
这工作,它返回验证的accessToken。
我正在尝试实现GraphQL(Apollo服务器v.2)。我设法让它工作,我可以从GraphQL解析器调用任何Feathers服务。
当然,我可以继续自己编写所有内容 - 向用户查询并验证。但由于身份验证服务已经到位 - 我可以重新使用它吗?
我可以得到服务对象:
const authService = app.service('authentication');
我可以调用一些函数来获取经过验证的accessToken,例如:
return authService.someFunction({“strategy”:“local”,“email”:“[email protected]”,“password”:“password”});
只有两种方法可供选择
Create不验证 - 它只是根据参数生成JWT。
有人可以给我一个帮助或任何想法吗?感谢任何帮助。
使用的方法是标准的Feathers服务create
method:
return authService.create({
"strategy": "local",
"email": "[email protected]",
"password": "password"
});
您可以在basics guide中了解有关Feathers服务的更多信息以及authentication server API documentation中的身份验证服务。