RS256 jwt证书不适用于FeathersJS

时间:2018-10-01 12:12:52

标签: feathersjs

我不能让FeathersJs沿RS256工作。我使用了发电机,但是我收到了 error: NotAuthenticated: error:0906D06C:PEM routines:PEM_read_bio:no start line,当用户使用正确的JWT访问令牌登录时。

"authentication": {
    "secret": "whateverSecret",
    "strategies": [
      "jwt"
    ],
    "path": "/authentication",
    "service": "users",
    "jwt": {
      "header": {
        "typ": "access"
      },
      "audience": "https://yourdomain.com",
      "subject": "anonymous",
      "issuer": "feathers",
      "algorithm": "RS256", //set to RS256
      "expiresIn": "1d"
    },
    "auth0": {
      "clientID": "myClientid",
      "clientSecret": "myClientSecret",
      "successRedirect": "/",
      "domain": "myDomain.auth0.com",
      "scopes": [
        "profile"
      ]
    },
    "cookie": {
      "enabled": true,
      "name": "feathers-jwt",
      "httpOnly": false,
      "secure": false
    }
  }

和user.hooks.js内部是默认生成器。

1 个答案:

答案 0 :(得分:1)

RS256需要更多配置才能工作。 This issue提到要确保您的私钥(secret)是有效的证书并包含正确的换行符。

在验证JWT时,您可能还必须customize the JWT verifier传递公共密钥作为签名秘密。