#Java Spring KeyCLoak + Docker keep getting 401 error when using token
1 messages · Page 1 of 1 (latest)
mariadb:
image: mariadb:11
container_name: bachhoanhanh-mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: appdb
MYSQL_USER: appuser
MYSQL_PASSWORD: apppassword
ports:
- "3306:3306"
healthcheck:
test: ["CMD", "mariadb-admin", "ping", "-h", "localhost"]
interval: 5s
timeout: 5s
retries: 10
eureka-server:
build: ./eureka-server
container_name: eureka-server
ports:
- "8761:8761"
keycloak:
image: quay.io/keycloak/keycloak:24.0.2
container_name: keycloak
command: start-dev --import-realm
environment:
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
KC_HTTP_ENABLED: "true"
KC_HOSTNAME: localhost
KC_HOSTNAME_PORT: 8082
KC_PROXY: edge
ports:
- "8082:8080"
volumes:
- ./keycloak/realm:/opt/keycloak/data/import
product-service:
build: ./product-service
container_name: product-service
restart: always
ports:
- "8080:8080"
depends_on:
mariadb:
condition: service_healthy
eureka-server:
condition: service_started
order-service:
build: ./order-service
container_name: order-service
restart: always
ports:
- "8081:8081"
depends_on:
- product-service
- eureka-server
gateway-service:
build: ./gateway-service
container_name: gateway-service
restart: always
ports:
- "9000:9000"
depends_on:
- eureka-server
- product-service
- order-service```
Detected code, here are some useful tools:
i logged in with http://localhost:8082/realms/bachhoanhanh/protocol/openid-connect/token
i use that token with
http://localhost:9000/products
but getting 401 error,
all images were running in docker