I have a realm called 1234. I used the 1234’s user to retrieve the token. And then I used Postman to send the post request to the following URL. I got the following error. Any suggestion?
http:///auth/admin/realms/<1234>/roles
403 Forbidden:
{
“error”: “unknown_error”
}
Send the details of the POST request you’re making so we can help debug.
Also, you should lose the <>
around the realm name. It should just be http://<your host>/auth/admin/realms/1234/roles
.
An example POST request to create a new role (I’m assuming that’s what you’re trying to do). Looks like this:
curl http://localhost:8080/auth/admin/realms/1234/roles \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Bearer $(./token.sh)" \
--data "{ \"name\": \"somerole\", \"description\": \"somedescription\" }"
(The script in there $(./token.sh)
just calls another script that retrieves the user’s token. You can replace that with your token.)
Sorry, I made a mistake in my original post, the calling method on the roles API was actually GET. I just wanted to get a simple get working first. I used Postman doing HTTP call directly instead of CLI approach.