[keycloak-user] Fwd: 405 on importing a realm

Kishan Sagathiya ksagathi at redhat.com
Thu Oct 12 00:04:20 EDT 2017


---------- Forwarded message ----------
From: Kishan Sagathiya <ksagathi at redhat.com>
Date: Thu, Oct 12, 2017 at 8:05 AM
Subject: Re: 405 on importing a realm
To: Bruno Oliveira <bruno at abstractj.org>


The second curl results in a 502 bad gateway. Also take a note that I am
not running on localhost, but on a remote server without https

On Wed, Oct 11, 2017 at 5:56 PM, Bruno Oliveira <bruno at abstractj.org> wrote:

> 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/re
> alms/$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