【发布时间】:2020-10-16 11:57:28
【问题描述】:
我有一个问题:
WWW-Authenticate Bearer realm="test", error="invalid_token", error_description="Invalid token issuer. Expected 'http://keycloak:8080/auth/realms/test', but was 'http://localhost:8080/auth/realms/test'"
我的设置:
application.yml
keycloak:
realm: test
resource: api
auth-server-url: http://keycloak:8080/auth
ssl-required: external
autodetect-bearer-only: true
cors: true
principal-attribute: preferred_username
credentials:
secret: 2b553733-8d5f-4276-8ace-17112ac7ac20
docker-compose.yml
keycloak:
image: jboss/keycloak:10.0.0
environment:
- KEYCLOAK_USER=admin
- KEYCLOAK_PASSWORD=admin
ports:
- "8080:8080"
networks:
- net
认证网址:http://localhost:8080/auth/realms/test/protocol/openid-connect/auth 令牌网址:http://localhost:8080/auth/realms/test/protocol/openid-connect/token
我明白问题存在的原因,但我不明白如何解决它。
【问题讨论】:
-
我相信你在本地运行 keycloak?然后在您的应用程序中将
auth-server-url: http://keycloak:8080/auth替换为auth-server-url: http://localhost:8080/auth。 -
我必须使用
keycloak.proxy-url设置christophewillemsen.com/2021/06/08/…