Zitadel Go API 无法从非本地主机运行

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

我面临的问题是,当我自行托管 Zitadel 并尝试从与本地主机不同的 IP 连接到我的 API 之一时,我突然无法获得授权。

我正在使用 Zitadel go 后端教程中的代码。 我猜这一定是某种类型的 cors 问题,因为如果教程应用程序连接到本地主机上的 zitadel,相同的curl 命令运行正常,但它不能像这样工作:

var (
    // flags to be provided for running the example server
    domain = flag.String("domain", "192.168.41.151", "your ZITADEL instance domain (in the form: <instance>.zitadel.cloud or <yourdomain>)")
    key    = flag.String("key", "./267348118540921239.json", "path to your key.json")
    port   = flag.String("port", "8090", "port to run the server on (default is 8090)")

    // tasks are used to store an in-memory list used in the protected endpoint
    tasks []string
)

....卷曲:

curl -i -H "Authorization: Bearer vkpUuK_nrnqh_jwFI2CKUutbFO0k_ArT2gxkiECNQ40DgGqnKeWNKOt_ikY3ww83FRgbI0Y" http://localhost:8090/api/tasks
HTTP/1.1 401 Unauthorized
Content-Type: text/plain; charset=utf-8
X-Content-Type-Options: nosniff
Date: Thu, 16 May 2024 08:27:07 GMT
Content-Length: 97

token introspection failed: http status not ok: 400 Bad Request {"error":"unauthorized_client"}

但是,我在 Zitadel 仪表板中找不到与这些设置相关的任何设置。

go cors backend
1个回答
0
投票

没关系,问题不在于 Zitadel 或 Zitadel-Go 软件包。这是因为 Zitadel 机器上的时间比托管时间晚了几秒,导致令牌未来在 Zitadel 这边

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