<div dir="ltr"><div class="gmail_quote"><div dir="ltr">Hi all,<div><br></div><div>I&#39;m building a new app using GWT 2.7 using the Keycloak javascript adapter and GWT jsInterop. This works extremely well.</div><div><br></div><div>The problem I ran into is if I walk away for 5 minutes and then try to do something, the token refresh fails on preflight.   As shown in the documentation, I call keycloak.updateToken(30) to refresh the base token in case it has expired.  Since in this case it has indeed expired, keycloak makes a call to /auth/realms/&lt;myrealm&gt;/tokens/refresh.    The OPTIONS call to this location doesn&#39;t contain the Accept headers, and my app ends up dead in the water.</div><div><br></div><div>To fix this, I added the following code to OpenIDConnectService:</div><div><br></div>/**<br> * CORS preflight path for refresh token requests<br> *<br> * @return<br> */<br>@Path(&quot;refresh&quot;)<br>@OPTIONS<br>@Produces(MediaType.APPLICATION_JSON)<br>public Response refreshAccessTokenPreflight() {<br>    if (logger.isDebugEnabled()) {<br>        logger.debugv(&quot;cors request from: {0}&quot;, request.getHttpHeaders().getRequestHeaders().getFirst(&quot;Origin&quot;));<br>    }<br>    return Cors.add(request, Response.ok()).auth().preflight().build();<br>}<div><br></div><div>If this wasn&#39;t the correct solution for my problem, I&#39;d enjoy hearing where I went wrong.</div><div><br></div><div>Thanks,</div><div>Alain</div><div><br></div></div></div></div>