depending on the size of the trim, you can use finish nails and some good yellow glue. You can use doweling fasteners, strong, but more time. Use a brad with glue also. Use clamps, either c clamps or bar clamps to secure during drying time. Really your question depends on the size of the trim. Glue should go with all the types of fasteners anyway.