[keycloak-dev] Trying to use Admin WS but got 401 Unauthorized
Stian Thorgersen
sthorger at redhat.com
Wed Oct 28 10:54:48 EDT 2015
You should use the master realm as it permits access to all realms as well
as creating realms.
Create a client ;)
On 28 October 2015 at 06:17, Giulio Vito de Musso <
giulio.vito.demusso at gmail.com> wrote:
> Hi Stian, all,
>
> Reading your first link I can see that the URL to call to get a token is
>
> http:<KeycloakHost>/auth/realms/{realm-name}/protocol/openid-connect/token
> "
>
> But what is the realm-name to use? I'm trying to execute an operation
> which is above all realms (which is create a new realm posting the JSON)
>
> Moreover I should provide a client_id in the request body, but I don't
> know which client ID to use.
>
> Thanks
> Giulio
>
>
> 2015-10-28 3:49 GMT+01:00 Stian Thorgersen <sthorger at redhat.com>:
>
>> You'll need a bearer token to invoke the services. A token can be
>> obtained either using the direct grant (or resource owner password grant as
>> oauth calls it) or using the standard web flow.
>>
>> Take a look at:
>>
>> https://github.com/keycloak/keycloak/blob/master/examples/demo-template/admin-access-app/src/main/java/org/keycloak/example/AdminClient.java
>>
>> Or if you are invoking from Java, simply use our Java admin client lib:
>>
>> https://github.com/keycloak/keycloak/blob/master/examples/admin-client/src/main/webapp/index.jsp
>>
>> On 27 October 2015 at 07:09, Giulio Vito de Musso <
>> giulio.vito.demusso at gmail.com> wrote:
>>
>>>
>>> Hello you all,
>>>
>>> I need to configure realms in Keycloak through the Admin WS accessible
>>> at the path
>>>
>>> http://KeycloakServer:8081/auth/admin/realms
>>>
>>> So in Postman I run the following request
>>>
>>> URL: http://KeycloakServer:8081/auth/admin/realms
>>>
>>> Method: POST
>>>
>>> Body:
>>>
>>> {
>>> "enabled": true,
>>> "id": "TestRealm",
>>> }
>>>
>>> I get a 401 Unauthorized response, so I think it is necessary to
>>> authenticate to the Admin WS. But in the docs I cannot find any information
>>> about the type of authentication required and the syntax. Do you know how
>>> to authenticate to the Keycloak WSs?
>>>
>>> Thank you
>>>
>>> _______________________________________________
>>> keycloak-dev mailing list
>>> keycloak-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/keycloak-dev
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-dev/attachments/20151028/f4f9f6ea/attachment-0001.html
More information about the keycloak-dev
mailing list