今天在官网下载了最新版本的 Nacos,启动的时候出现错误:
nested exception is java.lang.IllegalArgumentException: the length of secret key must great than or equal 32 bytes; And the secret key must be encoded by base64.Please see https://nacos.io/zh-cn/docs/v2/guide/user/auth.html
他说什么密钥需要大于或者等于32位Base64编码的字符,转到官网查看一些配置,发现 nacos.core.auth.plugin.nacos.token.secret.key
这项配置在 2.2.0.1 版本中不再配置默认值
参数名 | 默认值 | 启止版本 | 说明 |
---|---|---|---|
nacos.core.auth.plugin.nacos.token.secret.key | SecretKey012345678901234567890123456789012345678901234567890123456789(2.2.0.1后无默认值) | 2.1.0 ~ latest | 默认鉴权插件用于生成用户登陆临时accessToken所使用的密钥,使用默认值有安全风险 |
了解这些后在 nacos/conf/application.properties
配置文件中配置它再启动就可以了:
nacos.core.auth.plugin.nacos.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789
标签:启动,nacos,auth,Nacos,secret,失败,key,默认值
From: https://www.cnblogs.com/CloverYou/p/17474207.html