Keycloak Admin WS Login Attempt

I need to configure areas in Keycloak using Admin WS, available along the way

http://KeycloakServer:8081/auth/admin/realms

So, in Postman, I run the following query

URL: http://KeycloakServer:8081/auth/admin/realms

Method: POST

Body:

{
    "enabled": true,
    "id": "TestRealm",
}

I get a response 401 Unauthorized, so I think it is necessary to authenticate to Admin WS. But in the documents I can not find any information about the type of authentication required and the syntax. Do you know how to authenticate with WS-Keycloak?

thanks

+4
source share
2 answers

Make a POST request for https://hostname:8080/auth/realms/master/protocol/openid-connect/token

Installs Content-Typeinapplication/x-www-form-urlencoded

and put the following in the body:

username=<username>&password=<password>&client_id=admin-cli&grant_type=password
+9
source

This will help you. Make a message on

URI - /auth/realms/master/protocol/openid-connect/token

with headings below

  • username=<admin username>
  • password=<admin password>
  • client_id=security-admin-console
  • grant_type=password
  • Content-Type=application/x-www-form-urlencoded

JSON, access_token . . .

, - .

+2

Source: https://habr.com/ru/post/1613330/


All Articles