From f8548952c484d8fc0e40bcedb2bb2fd129404449 Mon Sep 17 00:00:00 2001 From: Alex Burt Date: Wed, 17 Dec 2025 11:29:26 +0000 Subject: [PATCH 1/2] SDK-2771: Read from the error stream if we get >= 400 HTTP status code from auth service --- .../src/main/java/com/yoti/auth/FormRequestClient.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yoti-sdk-auth/src/main/java/com/yoti/auth/FormRequestClient.java b/yoti-sdk-auth/src/main/java/com/yoti/auth/FormRequestClient.java index fbb46372..becfc1dd 100644 --- a/yoti-sdk-auth/src/main/java/com/yoti/auth/FormRequestClient.java +++ b/yoti-sdk-auth/src/main/java/com/yoti/auth/FormRequestClient.java @@ -59,14 +59,14 @@ private static String encode(String v) { private byte[] parseResponse(HttpURLConnection httpUrlConnection) throws ResourceException, IOException { int responseCode = httpUrlConnection.getResponseCode(); if (responseCode >= HttpURLConnection.HTTP_BAD_REQUEST) { - byte[] responseBody = readBody(httpUrlConnection); + byte[] responseBody = readBody(httpUrlConnection.getErrorStream()); throw new ResourceException(responseCode, httpUrlConnection.getResponseMessage(), new String(responseBody)); } - return readBody(httpUrlConnection); + return readBody(httpUrlConnection.getInputStream()); } - private byte[] readBody(HttpURLConnection httpURLConnection) throws IOException { - try (QuietCloseable inputStream = new QuietCloseable<>(httpURLConnection.getInputStream())) { + private byte[] readBody(InputStream httpInputStream) throws IOException { + try (QuietCloseable inputStream = new QuietCloseable<>(httpInputStream)) { return readChunked(inputStream.get()); } } From f36aabecf9e5f0e5e095c27b10ed38811d850841 Mon Sep 17 00:00:00 2001 From: Alex Burt Date: Wed, 17 Dec 2025 11:29:50 +0000 Subject: [PATCH 2/2] SDK-2771: Specify exact json property names for response from auth service --- .../com/yoti/auth/CreateAuthenticationTokenResponse.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/yoti-sdk-auth/src/main/java/com/yoti/auth/CreateAuthenticationTokenResponse.java b/yoti-sdk-auth/src/main/java/com/yoti/auth/CreateAuthenticationTokenResponse.java index 9d437c72..3f4cb439 100644 --- a/yoti-sdk-auth/src/main/java/com/yoti/auth/CreateAuthenticationTokenResponse.java +++ b/yoti-sdk-auth/src/main/java/com/yoti/auth/CreateAuthenticationTokenResponse.java @@ -1,10 +1,19 @@ package com.yoti.auth; +import com.fasterxml.jackson.annotation.JsonProperty; + public final class CreateAuthenticationTokenResponse { + @JsonProperty("access_token") private String accessToken; + + @JsonProperty("token_type") private String tokenType; + + @JsonProperty("expires_in") private Integer expiresIn; + + @JsonProperty("scope") private String scope; /**