okta / okta-idx-java

okta-idx-java
https://github.com/okta/okta-idx-java
Other
14 stars 23 forks source link

AuthenticationResponse.getErrors() Doesn't Always Return a Meaningful Error Message #500

Open emanor-okta opened 3 months ago

emanor-okta commented 3 months ago

Testing with Latest okta-idx-java 3.0.7

Using the below code,

AuthenticationResponse beginResponse = idxAuthenticationWrapper.begin(new RequestContext());
for (String error: beginResponse.getErrors()) {
      System.out.println("Error: " + error);
}

If an invalid client_id is provided to the SDK the following is logged,

Error: null:null

The raw message returned from Okta,

{
   "errorCode": "invalid_client",
   "errorSummary": "Invalid value for 'client_id' parameter.",
   "errorLink": "invalid_client",
   "errorId": "oaeS1WCm9sfRZiWy4NwK2z-bg",
   "errorCauses": []
}

If instead the scope openid is left out of the above request, then the following is logged,

Error: invalid_scope:Requests for ID tokens or access tokens with OpenID scopes require the 'openid' scope.

The raw message returned from Okta,

{
   "error": "invalid_scope",
   "error_description": "Requests for ID tokens or access tokens with OpenID scopes require the 'openid' scope."
}
arvindkrishnakumar-okta commented 3 months ago

@emanor-okta Thanks for posting! This may have already been fixed with the latest code in master. Can you please try with the latest code from master? I'll cut a release soon.