我正在使用okta java api来验证用户凭据。 AuthApiClient.authenticate(username,password,someRelayState)方法抛出com.fasterxml.jackson.core.JsonParseException:
意外字符('<'(代码60)):预期有效值(数字,字符串,数组,对象,'true','false'或'null')。请参阅我的java代码和错误堆栈跟踪部分:
栈跟踪
com.fasterxml。enter image description here jackson.core.JsonParseException:意外字符('<'(代码60)):预期有效值(数字,字符串,数组,对象,'true','false '或'null') 在[来源:org.apache.http.conn.EofSensorInputStream@1fde5d22; line:1,column:2] 在com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1486) at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:518) 在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.nextToken(UTF8StreamJsonParser.java:697) at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3600) at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:3518) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:1892) 在com.fasterxml.jackson.core.JsonParser.readValueAs(JsonParser.java:1434) 在com.okta.sdk.framework.JsonApiClient.unmarshall(JsonApiClient.java:57) 在com.okta.sdk.framework.ApiClient.extractError(ApiClient.java:294) 在com.okta.sdk.framework.ApiClient.checkResponse(ApiClient.java:285) 在com.okta.sdk.framework.ApiClient.unmarshallResponse(ApiClient.java:258) 在com.okta.sdk.framework.ApiClient.post(ApiClient.java:111) 在com.okta.sdk.framework.ApiClient.post(ApiClient.java:103) 在com.okta.sdk.clients.AuthApiClient.authenticate(AuthApiClient.java:63) 在com.okta.sdk.clients.AuthApiClient.authenticate(AuthApiClient.java:54) 在com.okta.sdk.clients.AuthApiClient.authenticate(AuthApiClient.java:50) 在org.avancer.scim.servlet.TestClass.testMethod(未知来源) 在org.avancer.scim.servlet.TestClass.main(未知来源)
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();
}