Blend the shallots, garlic, candlenuts, ginger, galangal, coriander, turmeric and salt with 2 tablespoons of water into a rough paste. A small blender or a mortar and pestle both work. It does not need to be perfectly smooth.
Heat the oil in a wide pan or Dutch oven over medium heat. Add the spice paste, lemongrass and bay leaves and fry, stirring often, for 4 to 5 minutes until the raw shallot smell is gone and the paste has darkened slightly and started to stick.
Add the chicken thighs and turn them in the paste until coated. Pour in the water and tamarind and add 2 tablespoons of the kecap manis. Bring to a simmer, cover, and cook for 15 minutes, turning the thighs once halfway.
Uncover and raise the heat. Let the liquid bubble down for 5 to 8 minutes, turning the chicken now and then, until only a few tablespoons of thick, dark sauce remain clinging to the meat. Fish out the lemongrass and bay leaves. The chicken is fully cooked at this point.
Stir the remaining 3 tablespoons of kecap manis into whatever sauce is left in the pan to make the glaze. Set the broiler to high and put a rack about 5 inches from the element. Line a sheet pan with foil.
Lay the thighs on the pan and brush with glaze. Broil for 3 to 4 minutes until the edges char and the sugar in the glaze starts to blister. Flip, brush with more glaze, and broil another 3 minutes. Watch it closely, kecap manis goes from caramelised to burnt in under a minute.
Squeeze the lime juice over the chicken, then scatter the sliced chili and fried shallots on top. Serve with rice, sambal and cucumber slices.