意外收到JWT alg,预期是RS256,得到:HS256

问题描述 投票:0回答:1

我有一个 Auth0 租户,我首先手动配置它,它与我的应用程序一起使用。现在我已改用 terraform 管理它,从那时起我在登录该状态时收到错误

Callback handler failed. CAUSE: unexpected JWT alg received, expected RS256, got: HS256

我检查了应用程序,令牌算法仍然列为RS256。另外,在 Terraform Config 中,我专门添加了此属性。 JWT 使用错误的算法进行签名的原因可能是什么?

这就是 terraform 中 API 资源的定义方式:

resource "auth0_resource_server" "api" {
  identifier = "my-id"
  name       = "My Name"

  allow_offline_access                            = false
  enforce_policies                                = true
  skip_consent_for_verifiable_first_party_clients = true

  signing_alg            = "RS256"
  signing_secret         = null
  token_dialect          = "access_token_authz"
  token_lifetime         = 86400
  token_lifetime_for_web = 7200
  verification_location  = null
}
terraform jwt auth0
1个回答
0
投票

我们缺少配置的另一部分。提供的配置仅适用于 api,但客户端也允许指定 jwt 配置:

resource "auth0_client" "client" {
  # ...

  jwt_configuration {
    alg                 = "RS256"
    # ...
  }
}

这解决了问题。

© www.soinside.com 2019 - 2024. All rights reserved.