In generateSession method:
if (responseJson.has("Success") && !responseJson.isNull("Success") && !responseJson.getString("Success").isEmpty() && !responseJson.getString("Success").isBlank()) {
JSONObject successJson = new JSONObject(responseJson.getString("Success"));
String base64SessionToken = successJson.get("session_token").toString();
should ideally be changed to:
if (responseJson.has("Success") && !responseJson.isNull("Success") && !responseJson.getJSONObject("Success").isEmpty()) {
var successJson = responseJson.getJSONObject("Success");
String base64SessionToken = successJson.getString("session_token");
.......
}
as "Success" is a JSONObject and not a String otherwise it keeps throwing error: responseJson.getString("Success") is not a String.
In generateSession method:
if (responseJson.has("Success") && !responseJson.isNull("Success") && !responseJson.getString("Success").isEmpty() && !responseJson.getString("Success").isBlank()) {
JSONObject successJson = new JSONObject(responseJson.getString("Success"));
String base64SessionToken = successJson.get("session_token").toString();
should ideally be changed to:
if (responseJson.has("Success") && !responseJson.isNull("Success") && !responseJson.getJSONObject("Success").isEmpty()) {
var successJson = responseJson.getJSONObject("Success");
String base64SessionToken = successJson.getString("session_token");
.......
}
as "Success" is a JSONObject and not a String otherwise it keeps throwing error: responseJson.getString("Success") is not a String.