public static String extractClientIdFromToken(final String token) throws Exception {
        val claims = JwtBuilder.parse(token);
        if (claims != null) {
            return claims.getClaimAsString(OAuth20Constants.CLIENT_ID);
        }
        val header = JwtBuilder.parseHeader(token);
        return (String) header.getCustomParam(OAuth20Constants.CLIENT_ID);
    }
Extract client id from token.

@param token the token
@return the string
@throws Exception the exception
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/util/OAuth20Utils.java