[keycloak-user] 405 on importing a realm

Bruno Oliveira bruno at abstractj.org
Wed Oct 11 08:26:28 EDT 2017


I'm moving this discussion to keycloak-user, the appropriate place to
ask these questions. This should work:

#!/bin/bash

REALM="master"

export TKN=$(curl -v -X POST "http://localhost:8080/auth/realms/$REALM/protocol/openid-connect/token" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d "username=admin" \
 -d 'password=admin' \
 -d 'grant_type=password' \
 -d 'client_id=admin-cli' | jq -r '.access_token')

curl -v -X POST -H "Content-Type:application/json" -H "Authorization: Bearer $TKN" -d "@/path/of/your/realm/testrealm.json" http://localhost:8080/auth/admin/realms

On 2017-10-11, Kishan Sagathiya wrote:
> Hi,
> I am getting '405 Method Not Allowed'  on trying to create a realm using
> keycloak's admin rest api.
>
> Following is the command that I am running
>
>
> curl -H "Content-Type: application/json" -H "Authorization: bearer
> $ACCESS_TOKEN" -d 'rep=$CONTENT_OF_THE_JSONFILE' -D- -X POST  "
> http://mykeycloakurl.com/auth/admin/realms/master"
>
> Is this the right way?
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev

--

abstractj


More information about the keycloak-user mailing list