In general, this question mainly applies to people wanting to build a new home and with a permit for a composting toilet instead of a sewer or septic system, or in public places.

Some states have codes regulating composting toilets, like Oregon, Washington, and many states on the east coast. These codes typically require a NSF certified toilet. Site built toilets are only recently becoming legal.  Arizona is working on a pilot project to create site-built designs approved by the Department of Ecology. Oregon’s REACH code includes guidelines for site-built toilets.
Generally, people who live in a house with an existing toilet can use a composting toilet without breaking any laws so long as they:
1) Have at least one flush toilet connected to an approved sewer or septic system.
2) Don’t transport the humanure across property lines.
3) Don’t create a public nuisance (odors, etc.)