WASHINGTON — When President Joe Biden showed off his putting during a campaign stop at a public golf course in Michigan last month, the moment was captured on TikTok.

Forced inside by a rainstorm, he competed with 13-year-old Hurley “HJ” Coleman IV to make putts on a practice mat. The Coleman family posted video of the proceedings on the app — complete with Biden holing out a putt and the teen knocking his own shot home over the caption “I had to sink the rebuttal.”

The network television cameras that normally follow the president were stuck outside.

Biden signed legislation Wednesday that could ban TikTok in the U.S. while his campaign has embraced the platform and tried to work with influencers. The president, already struggling to maintain his previous support from younger voters, is facing criticism from some avid users of the app, which researchers have found is a primary news source for a third of Americans younger than 30.

“There’s a core hypocrisy to the Biden administration supporting the TikTok ban while at the same time using TikTok for his campaign purposes,” said Kahlil Greene, who has more than 650,000 followers and is known on TikTok as the Gen Z Historian.

“I think it illustrates that he and his people know the power and necessity of TikTok.”

The Biden campaign defends its approach and rejects the idea that White House policy is contradicting its political efforts.

“We would be silly to write off any place where people are getting information about the president,” said Rob Flaherty, who ran the White House’s Office of Digital Strategy and now is deputy manager of Biden’s reelection campaign.

Flaherty said Biden’s team forged relationships with TikTok influencers during the 2020 election and that the platform has only gotten more influential since then, “growing as an internet search engine and driving narratives about the president.”

The Biden campaign says an increasingly fragmented modern media environment requires it to meet voters where they are and TikTok is one of many such places where would-be supporters see its content, in addition to WhatsApp, Facebook, Instagram and YouTube.

It has produced its own TikTok content,but also relied on everyday users who interact with the president. That includes a post from a family that ate fries and other fixings from the Cook Out fast-food chain when Biden recently visited Raleigh, North Carolina.

Opponents of TikTok say its ownership by Chinese company ByteDance gives Beijing a dangerous amount of influence over what narratives Americans see as well as potential access to U.S. user data. Chinese national-security laws allow the ruling Communist Party wide latitude over private business, although the U.S. has not made public evidence that the Chinese government has manipulated the app or forced ByteDance to do its bidding.

The law Biden signed Wednesday would force ByteDance to sell the app to a U.S. company within a year or face a national ban. ByteDance says the law violates the First Amendment and promised to sue.

Former President Donald Trump, the presumptive Republican nominee, now publicly opposes a TikTok ban after issuing an executive order while in office trying to ban the app if ByteDance didn’t sell it.

The White House doesn’t have an official TikTok account; Biden banned the app on most government devices in December 2022. Yet the Biden campaign also officially joined TikTok on the night of this year’s Super Bowl, as the president shunned a traditional game day TV interview to instead spread a political message with the platform.

Former White House press secretary Jen Psaki convened a virtual briefing in 2022 for more than two dozen of the app’s influencers to discuss the U.S. approach to Ukraine, a gathering later parodied on “Saturday Night Live.”

There have been scores of other such events, including an influencer party at the White House last Christmas and a State of the Union watch party in March.

The legislation Biden signed “is not a ban. This is about our national security,” White House press secretary Karine Jean-Pierre said. The White House isn’t saying “that we do not want Americans to use TikTok.”

TikTok has 170 million U.S. users, and a study released in November by the Pew Research Center found that a third of U.S. adults younger than 30 regularly got news from TikTok, compared to 14% of all adults.

An AP-NORC poll conducted in January said nearly half of 18- to 29-year-olds are opposed to a ban on the use of TikTok in the U.S., compared to 35% of U.S. adults. Two in 10 U.S. adults said they use TikTok at least once a day, including 44% of 18- to 29-year-olds. Among 18- to 29-year-olds, 7% say they use TikTok “almost constantly” and 28% are using it “several times a day.”

Even if TikTok is eventually banned, most of its influencers are on other platforms that could take their content, especially YouTube and Instagram, said Danielle Butterfield, executive director of Priorities USA, a leading Democratic super PAC.

Greene studied history at Yale, served as the school’s first Black student body president and graduated in 2022. He attended past White House events as an influencer, including a Juneteenth celebration and a West Wing event for the Inflation Reduction Act, a sweeping health care and green energy package, where he met Biden and Vice President Kamala Harris.

About a year ago, however, Greene began posting about Biden’s championing a sweeping 1994 crime law that activists have long said contributed to the mass incarceration of racial minorities. He also criticized Biden’s administration for what he called “a lack of specific policy made for Black Americans.”

Since then, he says, he’s no longer invited to more personal events while some “creators who fell in line, who are less critical” are still going.

Flaherty said the campaign has paid influencers in specific instances, like when their content has been used in ads, and some content creators who work with the campaign have raised concerns about legislation forcing divestment. But he doesn’t see it having a major Election Day impact.