Legislation that would allow San Francisco to open safe-injection sites cleared the state Assembly on Thursday.

The bill, AB362, was authored by Assemblywoman Susan Eggman, D-Stockton, and co-authored by Sen. Scott Wiener, D-San Francisco.

If approved by the state Senate and Gov. Gavin Newsom, it would allow San Francisco officials to open facilities where intravenous drug users would be provided with clean needles and other equipment and shoot up under clinical supervision.

Then-Gov. Jerry Brown vetoed similar legislation last October, saying he would not support a bill that didn’t include mandates that drug users undergo treatment. By contrast, Newsom has said he’s “very, very open” to a pilot program for safe injection sites.

Mayor London Breed has been among the most vocal champions of opening such a site in the city, going as far as to promote a mock facility last year intended to give residents a tactile tour of what such a place would look and feel like.

Safe injection sites have existed for years in Canada, Europe and Australia. Advocates have long maintained that allowing drug users to shoot up with clean equipment and supervision can virtually eliminate overdose deaths, curb the spread of infectious diseases and provide access to addiction-treatment services when people are ready to get clean.

But even if the state sanctions safe injection sites, opening one would still remain illegal under federal law, which prohibits “maintaining or providing access” to any space where illegal drugs are used. The Trump administration hasn’t hidden its hostility to the concept.

Last year, former U.S. Deputy Attorney General Rod Rosenstein took to the opinion pages of the New York Times to reiterate the administration’s stance, calling safe injection sites “very dangerous” and liable to “only make the opioid crisis worse.”

Email: cityinsider@sfchronicle.com, dfracassa@sfchronicle.com Twitter: @sfcityinsider, @dominicfracassa