Keycloak account self managment API

Viewed 47

I am building the application based on the keycloak, but I am struggling with one problem: how to make edit functionality for user using Angular and Keycloak API. Furthermore, user isn't admin or something like that, this is just regular user. I have tried this guide https://www.marcus-povey.co.uk/2020/10/12/using-the-keycloak-accounts-management-api/, but it doesn't help. Maybe I have done something wrong? I am using keycloak v.18

This is my docker compose file:

keycloak:
    env_file: .env.docker
    image: ${KEYCLOAK_IMAGE}
    build:
      context: ./keycloak
      args:
        - KEYCLOAK_IMAGE
    hostname: keycloack
    environment:
      KEYCLOAK_IMAGE: ${KEYCLOAK_IMAGE}
      KEYCLOAK_USER: user
      KEYCLOAK_PASSWORD: user
      KEYCLOAK_ADMIN: user
      KEYCLOAK_ADMIN_PASSWORD: user
      # KEYCLOAK_IMPORT: /tmp/realm-import.json
      #setting postgres as keycloak's database
      KC_DB_URL: jdbc:postgresql://keycloak-postgres-db:6402/keycloak_postgres
      KC_DB: postgres
      DB_DATABASE: keycloak_postgres
      KC_DB_USERNAME: root
      KC_DB_PASSWORD: root
      PROXY_ADDRESS_FORWARDING: "true"
      KC_FEATURES: 'account-api'
      KC_FEATURES_ACCOUNT_API: 'enabled'
    # Keyclock can't handle IPv6 and crashes without this
    # command: '-Djboss.bind.address.private=127.0.0.1 -Djboss.bind.address=0.0.0.0'
    command:
      - "start-dev --auto-build --hostname-strict=false -Dkeycloak.import=/opt/jboss/keycloak/realms/space-realm.json"
      # - "bin/standalone.sh -Dkeycloak.profile.feature.account_api=enabled"
    depends_on:
      - keycloak-postgres-db
    ports:
      - 8080:8080
    volumes:
      - keycloak_data:/opt/jboss/keycloak/standalone/data/
      # todo: add keyclock realm import data here

  keycloak-postgres-db:
    container_name: keycloak_postgres_db
    image: postgres:12
    hostname: keycloak-postgres-db
    ports:
      - "6402:6402"
    environment:
      PGPORT: "6402"
      POSTGRES_DB: keycloak_postgres
      POSTGRES_USER: root
      POSTGRES_PASSWORD: root
      PGDATA: ./data/postgres
    volumes:
      - keycloak_postgresdata:/data/postgres
    restart: always

And this is my Postman response:

enter image description here

I am so confused why is it HTML file? How can I allow user to make self-managment without admin status? Can someone help. Will be very appreciated for your help!

0 Answers
Related