简体   繁体   English

Cube.js:无效的令牌

[英]Cube.js: invalid token

In the server of cubejs, I generated a token by cubejs token -e "180 day" .在 cubejs 的服务器中,我通过cubejs token -e "180 day"生成了一个令牌。

Then I assign it to CUBEJS_API_SECRET in .env ;然后我将它分配给CUBEJS_API_SECRET中的.env and assign it to const cubejsApi = cubejs(... . Then I launched the backend and the frontend, I got the following error:并将其分配给const cubejsApi = cubejs(... 。然后我启动了后端和前端,出现以下错误:

Invalid Token: {
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1ODg5MzQyOTYsImV4cCI6MTYwNDQ4NjI5Nn0.RVdHlpfubXDgwG1FRYbUm-UDLVBjnb-HSVTK5bEy-ZU"
} 
JsonWebTokenError: invalid signature
    at /Users/chengtie/Downloads/tmp20200414/cubejs/node_modules/jsonwebtoken/verify.js:133:19
    at getSecret (/Users/chengtie/Downloads/tmp20200414/cubejs/node_modules/jsonwebtoken/verify.js:90:14)
    at Object.module.exports [as verify] (/Users/chengtie/Downloads/tmp20200414/cubejs/node_modules/jsonwebtoken/verify.js:94:10)
    at ApiGateway.defaultCheckAuth (/Users/chengtie/Downloads/tmp20200414/cubejs/node_modules/@cubejs-backend/api-gateway/index.js:551:28)
    at ApiGateway.checkAuth (/Users/chengtie/Downloads/tmp20200414/cubejs/node_modules/@cubejs-backend/api-gateway/index.js:572:18)
    at Layer.handle [as handle_request] (/Users/chengtie/Downloads/tmp20200414/cubejs/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/chengtie/Downloads/tmp20200414/cubejs/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/Users/chengtie/Downloads/tmp20200414/cubejs/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/Users/chengtie/Downloads/tmp20200414/cubejs/node_modules/express/lib/router/layer.js:95:5)
    at /Users/chengtie/Downloads/tmp20200414/cubejs/node_modules/express/lib/router/index.js:281:22

Regardless of this error, it seems that the data query worked.不管这个错误如何,数据查询似乎都有效。 Does anyone know what happened?有谁知道发生了什么?

CUBEJS_API_SECRET is generated by default when Cube.js project is created. CUBEJS_API_SECRET在创建 Cube.js 项目时默认生成。 Unless you want to redefine it you don't need to assign it in .env file.除非您想重新定义它,否则您不需要在.env文件中分配它。 You should only pass it to cubejs() on client side.您应该只将它传递给客户端的cubejs() Please see https://cube.dev/docs/security#generating-token .请参阅https://cube.dev/docs/security#generating-token

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM