There are various types of edible glue; such as royal icing, gum paste/water mixture, melted chocoloate, piping gel etc. Which glue you choose depends on each individual project. I would use royal icing to fasten the pieces of a gingerbread house together, for example, as it tends to be a strong adhesive. My favourite type of sweet glue is made with tylose powder. I've adapted
Replying to @waltdrio this is how I make my edible glue for
How to Make Edible Slime with Honey
How To Make Edible Glue
Secret Recipe: How To Make Edible Glue Without Tylose Powder - Cake Decorist
How to make #DIY Edible Glue Edible glue, Fondant cake toppers
How to Make Edible Glue - Easy
Edible Confectioners Glue Sugar glue recipe, Cookie recipes
➡How to make homemade edible glue with tylo powder - Cake Craft
How to Make Fondant Glue - A Step by Step Tutorial