<p>Locally everything works!</p>

<p>However, after a deployment to my Kubernetes k3s cluster on raspberrypi, which is accessible via https domain the oauth2 code exchange for token feature doesn't work. I currently support authentication via Google and GitHub and both of them have this problem. Below are the logs:</p>

<p>GitHub login failure:</p>

<pre><code>org.springframework.security.oauth2.core.OAuth2AuthenticationException: 
[invalid_token_response] An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: Error while extracting response for type [class org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse] and content type [application/json;charset=utf-8]; 
nested exception is org.springframework.http.converter.HttpMessageNotReadableException: An error occurred reading the OAuth 2.0 Access Token Response: tokenValue cannot be empty; 
nested exception is java.lang.IllegalArgumentException: tokenValue cannot be empty
</code></pre>

<p>Google login failure:</p>

<pre><code>org.springframework.security.oauth2.core.OAuth2AuthenticationException: 
[invalid_token_response] An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: I/O error on POST request for "https://www.googleapis.com/oauth2/v4/token": Invalid ECDH ServerKeyExchange signature; 
nested exception is javax.net.ssl.SSLHandshakeException: Invalid ECDH ServerKeyExchange signature
</code></pre>

<p>What I've already tried:</p>

<p>I thought it might be a problem with sending https requests from within my Kubernetes cluster, but I connected to the running pod and curled <a href="https://google.com" rel="nofollow noreferrer">https://google.com</a> and it worked just fine.</p>

<p>Have any of you guys encountered such a problem?</p>

<p>@edit
I'm using Java 11</p>

<p>@edit2
There seems to be a problem with docker on my raaspberrypi. Curling https requests work fine, but using <code>RestTemplate</code> in Java doesn't work</p>

<p>@edit3
Found a related issue <a href="https://github.com/docker-library/tomcat/issues/182" rel="nofollow noreferrer">https://github.com/docker-library/tomcat/issues/182</a></p>

Humberd
<p>Problem Solved and is not connected with spring or oauth configuration at all.</p>

<p>Adoptopenjdk Docker image for arm is broken. It prevents making https requests. Even the following example failed:</p>

<pre class="lang-kotlin prettyprint-override"><code>RestTemplate().getForEntity("https://google.com", String::class.java)
</code></pre>

<p>So the solution is to swap broken base image in my Dockerfile like this:</p>

<p>Previous:</p>

<pre><code>FROM adoptopenjdk/openjdk11:armv7l-ubuntu-jdk-11.0.6_10-slim
</code></pre>

<p>Current:</p>

<pre><code>FROM arm32v7/openjdk:11.0.3-slim
</code></pre>
