我正在尝试将我的 React Native Ios 项目与 Feathers js 集成。如果我的应用程序有任何社交登录,则需要将 Apple Sign In 方法包含到项目中才能发布到商店。
我正在尝试使用管理员、超级管理员等用户角色创建一些 REST API。我试图通过使用feathers-permissions模块来实现这一点,但没有工作示例和互联网。你曾经处理过这样的任务吗?我现在做的是:
feathers generate app然后feathers generate authentication。接下来我应该做什么?
javascript permissions rest feathersjs feathers-authentication
我有来自两个不同客户端(Angular 客户端和 Node.js Feathes 客户端)的传入连接,我希望它们使用两个不同的身份验证端点(基于两个单独表中的数据)。一个应该针对 /users 服务进行身份验证,另一些则针对 /user2 服务进行身份验证。
如何才能实现这一目标?
这是它与一个身份验证端点一起工作的方式:
// default.json
"authentication": {
"secret": "<secret>",
"strategies": [
"jwt",
"local"
],
"path": "/authentication",
"service": "users",
"jwt": {
"header": {
"typ": "access"
},
"audience": "https://yourdomain.com",
"subject": "anonymous",
"issuer": "feathers",
"algorithm": "HS256",
"expiresIn": "1d"
},
"local": {
"entity": "user",
"usernameField": "email",
"passwordField": "password"
}
}
// authentication.js
const authentication = require('@feathersjs/authentication');
const jwt = require('@feathersjs/authentication-jwt');
const local = require('@feathersjs/authentication-local');
module.exports = function (app) {
const config = app.get('authentication');
app.configure(authentication(config));
app.configure(jwt());
app.configure(local()); …Run Code Online (Sandbox Code Playgroud) 当我提取在 Mac 中运行良好的项目的工作代码时,在 Windows 中进行身份验证时出现此错误
错误
{
"name": "NotAuthenticated",
"message": "Invalid login",
"code": 401,
"className": "not-authenticated",
"errors": {}
Run Code Online (Sandbox Code Playgroud)
}
发布请求
{
"strategy": "local",
"username": "demo",
"password": "demo"
}
Run Code Online (Sandbox Code Playgroud)
默认.json
"authentication": {
"entity": "user",
"service": "users",
"secret": "2wVrC38R9sUb6Cjhuhoir3oate0=",
"authStrategies": [
"jwt",
"local"
],
"jwtOptions": {
"header": {
"type": "access"
},
"audience": "https://yourdomain.com",
"issuer": "feathers",
"algorithm": "HS256",
"expiresIn": "1d"
},
"local": {
"usernameField": "username",
"passwordField": "password"
}
Run Code Online (Sandbox Code Playgroud)
},
所以本地策略根本不起作用