<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Interesting issue. <br>
<br>
What is happening is, that state cookie with value "150/..." is
set and then your application redirects to keycloak login screen.
However it looks that "something" else set the new value of state
cookie (in you case "151/..."), so after keycloak login is
finished, adapter can see the value of cookie "151/...", but it
still expects the old value "150/..." .<br>
<br>
I can see 2 possibilities how it can happen:<br>
1) your application is opening more HTTP requests for secured URL
at the same time. For example you have HTML publicly available,
which opens some XHR requests (or images) under secured URL. When
the securedPage1 ( image1 ) is open, it redirects to keycloak,
however browser already also sent request to securedPage2 ( image2
), which rewrite the cookie set by securedPage1. <br>
2) The new cookie value is set after successful keycloak login and
redirect to your application. <br>
<br>
I suspect it's likely case 1. You can confirm it by doing this:<br>
- Open secured URL<br>
- Be redirected to keycloak login screen<br>
- At this point, you will check if value of "state" parameter in
the browser line is same as the value of
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
"OAUTH_TOKEN_REQUEST_STATE" cookie in your application (you will
need to check browser cookies). If it's different then the issue
is case 1. If it's same than it's rather case 2.<br>
<br>
Marek<br>
<br>
On 28/06/16 10:39, Gyalai Milán wrote:<br>
</div>
<blockquote cite="mid:577237C4.2010400@mail.thot-soft.com"
type="cite">
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
Hello,<br>
<br>
I have problem with the Bad request when the user login.<br>
<br>
I have a simple War with JSP-s. With the following keycloak.json<br>
<br>
{<br>
"realm": "test",<br>
"realm-public-key": "...",<br>
"auth-server-url": "keycloak-url",<br>
"ssl-required": "none",<br>
"resource": "dashboard-app",<br>
"public-client": true,<br>
"use-resource-role-mappings": false,<br>
"principal-attribute": "preferred_username"<br>
}<br>
<br>
The wildfly redirects to the keycloak perfectly and adds a status
parameter to the URL. After the login we get a 400 Bad request
error. In the wildfly log I found these lines.<br>
<br>
WARN [org.keycloak.adapters.OAuthRequestAuthenticator] (default
task-111) state parameter invalid<br>
WARN [org.keycloak.adapters.OAuthRequestAuthenticator] (default
task-111) cookie: 151/af93b54d-6b04-4d82-9a8b-1fe7203b279e<br>
WARN [org.keycloak.adapters.OAuthRequestAuthenticator] (default
task-111) queryParam: 150/e946fb78-9902-4449-8c33-687fcaf98d3d<br>
<br>
What did I configure wrong?<br>
<br>
The Keycloak version is 1.9.8.Final .<br>
<br>
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
Any ideas ?<br>
<br>
Regards<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
keycloak-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/keycloak-user">https://lists.jboss.org/mailman/listinfo/keycloak-user</a></pre>
</blockquote>
<br>
</body>
</html>