0

I am using okta java api to authenticate user credentials. AuthApiClient.authenticate(username, password, someRelayState) method is throwing com.fasterxml.jackson.core.JsonParseException:

Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null'). See bellow part of my java code code and error stacktrace:

STACKTRACE

com.fasterxml.enter image description herejackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: 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) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2486) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:801) at 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) at com.fasterxml.jackson.core.JsonParser.readValueAs(JsonParser.java:1434) at com.okta.sdk.framework.JsonApiClient.unmarshall(JsonApiClient.java:57) at com.okta.sdk.framework.ApiClient.extractError(ApiClient.java:294) at com.okta.sdk.framework.ApiClient.checkResponse(ApiClient.java:285) at com.okta.sdk.framework.ApiClient.unmarshallResponse(ApiClient.java:258) at com.okta.sdk.framework.ApiClient.post(ApiClient.java:111) at com.okta.sdk.framework.ApiClient.post(ApiClient.java:103) at com.okta.sdk.clients.AuthApiClient.authenticate(AuthApiClient.java:63) at com.okta.sdk.clients.AuthApiClient.authenticate(AuthApiClient.java:54) at com.okta.sdk.clients.AuthApiClient.authenticate(AuthApiClient.java:50) at org.avancer.scim.servlet.TestClass.testMethod(Unknown Source) at org.avancer.scim.servlet.TestClass.main(Unknown Source)


JAVA CODE:

    //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();
    }
A. Deo
  • 1
  • 1
  • Could you provide an example of the values being passed when this error occurs... – Cindy Meister Dec 09 '15 at 18:51
  • I was having the issue with wrong 'baseUrl'. Once, I figured that I deleted the post. However, to answer Cindy, I had to undelete it because it was not allowing me to reply back. Following are the values when I got the above error: \n – A. Deo Dec 11 '15 at 16:09
  • I was having the issue with wrong 'baseUrl'. Once, I figured that I deleted the post. However, to answer Cindy, I had to undelete it because it was not allowing me to reply back. Following is the value of baseUrl when I got the above error: baseUrl: "https://your_org.okta.com" – A. Deo Dec 11 '15 at 16:16

0 Answers0