During the 1960s, the Young Socialist Alliance (YSA) and Socialist Workers Party (SWP) were highly active in the movement against the Vietnam War and other social movements in the United States. Between 1962 and 1970, their leaderships sought to exclude homosexuality from their ranks. Using all available documentation, oral history, and correspondence, this article reconstructs for the first time how SWP and YSA members attracted to others of the same sex were either pushed out of the movement or compelled to circumvent the policy by building closets. By drawing on recent scholarship on the “straight state” in the United States, it explains that these socialist groups moved to bar same-sex sexuality because the state had incited both security concerns (fears that the government would pressure arrested homosexuals to become federal informants) and cultural anxiety (fears that “bohemian” styles would alienate American working-class recruits from socialism). It compares YSA and SWP policy to those of other leftist and working-class parties and organizations, including the Communist Party and Maoist and New Left organizations. After coming under strong external criticism by the gay and women's liberation movements, the YSA and SWP abandoned their antigay membership restriction in 1970. They therefore exemplify both the institutional suppression of homosexuality at midcentury and the transformations in civic and political culture generated by the gay liberation movement.