Preheat the oven to 400°F (200°C).
Combine the glutinous rice flour, palm sugar, coconut and pandanus or vanilla extract in a mixing bowl and mix well.
Heat 1 tablespoon of the oil in a wok or saucepan over low heat, turning to grease the sides. Stir-fry the coconut mixture for 20–25 minutes until dry. Remove from the heat.
Grease a baking tray with the remaining oil. Pour the cooked coconut mixture into the tray and level it with the back of a wet spoon.
Place the tray in the oven and bake for about 10 minutes, until the cake is golden brown on the surface. Cut the cake into the desired shapes and serve warm or at room temperature.