Washington(AP) — 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 in response, 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. Already struggling to maintain his previous support from younger voters, the president is now facing criticism from some avid users of the app, which researchers have found is a primary news source for a third of Americans under the age of 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 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 that an increasingly fragmented modern media environment requires it to meet voters where they are and that TikTok is one of many such places where would-be supporters see its content, in addition to platforms like 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, as well as Coleman’s putting video.

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, though 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 has argued 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 and 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 gameday 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. During Biden’s recent, $26 million campaign fundraiser at New York’s Radio City Music Hall with former Presidents Barack Obama and Bill Clinton, there was an influencer happy hour and an after-party where attendees interacted with Biden.

White House press secretary Karine Jean-Pierre said that the legislation Biden signed “is not a ban. This is about our national security.” She added that 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 last November by the Pew Research Center found that about a third of U.S. adults under 30 regularly got news from TikTok, compared to 14% of all adults.

Adults under 30 are more likely than U.S. adults overall to oppose a ban on the use of TikTok in the United States, according to an AP-NORC poll conducted in January. Nearly half of 18- to 29-year-olds are opposed, compared to 35% of U.S. adults.