我正在使用 okta java api 来验证用户凭据。AuthApiClient.authenticate(username, password, someRelayState) 方法正在抛出 com.fasterxml.jackson.core.JsonParseException:
意外字符(“<”(代码 60)):需要一个有效值(数字、字符串、数组、对象、“真”、“假”或“空”)。请参阅我的 java 代码代码和错误堆栈跟踪的以下部分:
堆栈跟踪
com.fasterxml。在此处输入图像描述jackson.core.JsonParseException:意外字符('<'(代码 60)):在 [来源:org.apache .http.conn.EofSensorInputStream@1fde5d22; line: 1, column: 2] at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1486) at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:518) at com .fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:447) 在 com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2486) 在 com.fasterxml.jackson.core.json .UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:801) 在 com.fasterxml.jackson.core.json.UTF8StreamJsonParser。
JAVA代码:
//Client configuration
ApiClientConfiguration oktaSettings = new ApiClientConfiguration(baseUrl, apiToken);
//authenticate and validate user credentials
AuthApiClient authClient = new AuthApiClient(oktaSettings);
// Check if the user credentials are valid
AuthResult result;
try {
result = authClient.authenticate(username, password, someRelayState);
// The result has a getStatus method which is a string of status of the request.
// Example - SUCCESS for successful authentication
String status = result.getStatus();
System.out.println(status);
} catch (IOException e) {
e.printStackTrace();
}