Repository navigation
Keycloak account api endpoint /accounts/credentials CORS issue #43403
|
Hi guys! In Keycloak 25.0.2 it was working just fine, but in 26.3.0 I am getting a CORS error. From the browser I can see that the first request with the OPTIONS method returns all the necessary headers such as I have Keycloak in a machine behind a Load Balancer, so it might be that I need to allow specifically some headers, but that doesn't seem to be the case since it is already working on my instance with Keycloak 25, with the same Load Balancer configuration - unless this is something new, added to Keycloak 26+. I am reading the upgrade guides but I haven't found anything about this specifically, so if someone has a better idea of what could be the issue here, I will be very thankful. By the way, I also noticed that this endpoint now requires the token to contain the Client Roles, which was not necessary in Keycloak 25. So, it seems more than just one thing has been changed in the Account Api, I wonder if there's a page or a changelog that I have missed where this is explained. |
Replies: 2 comments
|
Here is a screenshot of a direct CURL from the machines running keycloak 25 and 26 side by side. As you can see, the left one returns the Access-Control-Allow-Origin header, while the one on the right doesn't. This is a direct curl call against the Keycloak container with port 8080 exposed As you can see, the new Keycloak 26 does not return the Access Control headers. I wonder if there's a new configuration I need to add to the client to see this? Thanks a lot! |
|
Okay, I found the issue. The Account API apparently requires now that the keycloak "roles" and "origins" be included in the bearer access token. I recently removed these claims from the access token to avoid information leakage, but it seems from Keycloak 26+ this is required. So, in order to solve this, I had to go to Client Scopes, find the |
Okay, I found the issue. The Account API apparently requires now that the keycloak "roles" and "origins" be included in the bearer access token. I recently removed these claims from the access token to avoid information leakage, but it seems from Keycloak 26+ this is required.
So, in order to solve this, I had to go to Client Scopes, find the
web-originsand ensure in the Mappers that the value was added to the access token. Similarly, to therolesscope, and find the Client Roles mapper.