mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[iCloud] Ignore HTTP errors != 400 & >= 500 for 2-FA authentication (#14563)
* Ignore HTTP errors != 400 for 2-FA authentication --------- Signed-off-by: Simon Spielmann <simon.spielmann@gmx.de>
This commit is contained in:
parent
211955ccd6
commit
66d0377cff
@ -246,8 +246,14 @@ public class ICloudService {
|
|||||||
this.session.post(AUTH_ENDPOINT + "/verify/trusteddevice/securitycode", JsonUtils.toJson(requestBody),
|
this.session.post(AUTH_ENDPOINT + "/verify/trusteddevice/securitycode", JsonUtils.toJson(requestBody),
|
||||||
headers);
|
headers);
|
||||||
} catch (ICloudApiResponseException ex) {
|
} catch (ICloudApiResponseException ex) {
|
||||||
logger.debug("Code verification failed.", ex);
|
logger.trace("Exception on code verification with HTTP status {}. Verification might still be successful.",
|
||||||
return false;
|
ex.getStatusCode(), ex);
|
||||||
|
// iCloud API returns different 4xx error codes even if validation is successful
|
||||||
|
// currently 400 seems to show that verification "really" failed.
|
||||||
|
if (ex.getStatusCode() == 400 || ex.getStatusCode() >= 500) {
|
||||||
|
this.logger.debug("Verification failed with HTTP status {}.", ex.getStatusCode());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("Code verification successful.");
|
logger.debug("Code verification successful.");
|
||||||
|
Loading…
Reference in New Issue
Block a user