diff --git a/orcid-api-common/src/main/java/org/orcid/api/common/jaxb/OrcidExceptionMapper.java b/orcid-api-common/src/main/java/org/orcid/api/common/jaxb/OrcidExceptionMapper.java index d3dea7bdd2..953c29384f 100644 --- a/orcid-api-common/src/main/java/org/orcid/api/common/jaxb/OrcidExceptionMapper.java +++ b/orcid-api-common/src/main/java/org/orcid/api/common/jaxb/OrcidExceptionMapper.java @@ -88,7 +88,14 @@ public class OrcidExceptionMapper implements ExceptionMapper { public Response toResponse(Throwable t) { // Whatever exception has been caught, make sure we log it. String clientId = securityManager.getClientIdFromAPIRequest(); - if(t instanceof OrcidDeprecatedException + if(t instanceof OrcidInvalidScopeException) { + // This exception happens on client_credentials grant, so, the security manager doesn't have the client id info + OrcidInvalidScopeException ex = (OrcidInvalidScopeException) t; + if(clientId == null) { + clientId = ex.getClientId(); + } + logShortError(t, clientId); + } else if(t instanceof OrcidDeprecatedException || t instanceof LockedException || t instanceof DeactivatedException || t instanceof OrcidNoBioException diff --git a/orcid-api-common/src/main/java/org/orcid/api/common/oauth/OrcidClientCredentialEndPointDelegatorImpl.java b/orcid-api-common/src/main/java/org/orcid/api/common/oauth/OrcidClientCredentialEndPointDelegatorImpl.java index c4d1956aab..1f6cd5a8ce 100644 --- a/orcid-api-common/src/main/java/org/orcid/api/common/oauth/OrcidClientCredentialEndPointDelegatorImpl.java +++ b/orcid-api-common/src/main/java/org/orcid/api/common/oauth/OrcidClientCredentialEndPointDelegatorImpl.java @@ -131,7 +131,7 @@ public Response obtainOauth2Token(String authorization, MultivaluedMap