contrairy to what everyone here seems to be saying, maggots are not a definate no-no in composting.
you can make it work, tho it IS less desireable.
maggots are probably just from flies, I would imagine their there because you put in too much live organic matter in the beginning and didn't close the container correctly.
once the worms and maggots eat up all the live organic matter and convert it to "compost" the flies should loose interest. they lay their eggs on decaying organic matter so the larva (maggots) have something to eat. if theres little to none in your bin they should find somewhere else to lay their eggs.
still it wouldn't be a bad idea to sterilize your compost before use, especially if you plan on using it in potted plants(lots of info on goggle about sterilizing soil).
on to how to prevent this in the future...
I use those blue plastic tubs/totes for my vermiposting (the ones at walmart with the lids... the name isnt coming to mind atm). drill small holes all over it (lid, bottom, and sides) to allow air exchange (will reduce mold and help the worms breath). 1/8" holes are plenty big enough, more smaller holes would be better... sometimes baby worms escape, tho they dont seem to get far before shriveling up
then fill that with your organic matter (only a little to start), papper, cardboard, ect, and grit. I find it helpful to add in a decent ammount of soil (i usually just break up an rootball or 2 from some old potted plant, great way to reuse them
), not only does it give the worms a nice starting environment, but it keeps your finished vermipost from having that gloopy consistancy I've read about. mine always turns out like what you would get in a bag at the store...
I've never had maggots. only creatures I've had in my worm bins other then worms is springtails(which came in with my worms, but aparently dont effect plants), and thrips(good reason to get your worms from a good source!) that I've recently gotten rid of(after loosing 3 large tubs of vermipost :'<). other then that I've had a little mold in the beginning before, but it's not a problem and sorts it's self out given time. worms don't eat compost, they eat the micro-organisims that feed on the compost... a pile of rotting crap is actually quite complex, but enough about that.
also, earthworms aren't the best to use for vermiposting, you want a surface feeding worm such as red wigglers
any other questions, feel free to send me a pm or ask here.