President Trump issued two executive orders late Thursday against China-based TikTok and messaging app WeChat, citing national security concerns in a sweeping order that could prevent the companies from doing most business in the United States.

The orders take effect in 45 days and prohibit any U.S. company or person from transacting with ByteDance, TikTok’s Chinese parent company, or WeChat. While the nature of the banned transactions are not specific, it may mean the companies would not be able to appear on Apple’s App Store or Google’s Play Store in the United States. It also could make it illegal for U.S. companies to purchase advertising on TikTok.

But the order should not affect a deal if Microsoft or another U.S. firm manages to buy TikTok before the 45 days are up.

The orders signal increasing tensions in U.S.-China relations in the run-up to the November elections. Trump had earlier threatened to ban TikTok from the United States, citing national security concerns and suggesting it would be retaliation for what he sees as China’s role in the spread of the novel coronavirus.

Trump and other officials have expressed concern that data collected by TikTok could be shared with the Chinese government. TikTok has continually denied that and says it stores U.S. customer information in the United States. But Trump has continued targeting the company over the past week by threatening to ban it and finally seemingly agreeing to let Microsoft buy it, if a deal closes quickly.

“This data collection threatens to allow the Chinese Communist Party access to Americans’ personal and proprietary information — potentially allowing China to track the locations of Federal employees and contractors, build dossiers of personal information for blackmail, and conduct corporate espionage,” the TikTok order reads.

TikTok said Friday it was shocked by the president’s move, adding that it would pursue “all remedies available to us."

“This executive order risks undermining global businesses’ trust in the United States’ commitment to the rule of law, which has served as a magnet for investment and spurred decades of American economic growth. And it sets a dangerous precedent for the concept of free expression and open markets,” TikTok said in a statement on its website.

Microsoft spokesman Doug Dawson declined to comment. WeChat parent company Tencent said in a statement that it was reviewing the order.

WeChat is used universally in China for messaging and mobile payments, and widely used for other functions ranging from Web search to taxi hailing. It’s one of China’s most innovative Internet products to date, with Facebook adopting similar features years later in its Messenger app. But it’s also been adopted by Chinese officials as a useful surveillance tool, with growing numbers of people prosecuted for sharing politically sensitive content in chat groups.

It is unclear whether the order would prohibit people from sending messages or making payments using the service. WeChat parent company Tencent also owns a minority stake in the maker of popular video game Fortnite, but it seems the game is not included within the scope of the order, which relates specifically to WeChat.

TikTok has 100 million users in the United States and is especially popular with teenagers and young adults. TikTok fans have been urging followers to find them on other social media sites as they fear a ban.

Trump originally seemed to be leaning last week toward forcing ByteDance to divest its TikTok operations here through a process by the Committee on Foreign Investment in the United States (CFIUS). The committee began investigating ByteDance’s 2017 acquisition of Musical.ly, and could force it to unravel that deal.

But then the president switched course, and told reporters late Friday night that he would ban the app.

“As far as TikTok is concerned, we’re banning them from the United States,” Trump told reporters aboard Air Force One.

On Monday, Trump told reporters at the White House that TikTok would be forced to cease U.S. operations by about Sept. 15 if it wasn’t sold to a U.S. company. He also said that if a sale goes through, part of the proceeds should go to U.S. taxpayers.

“A very substantial portion of that price is going to have to come into the treasury of the United States,” Trump said of the potential TikTok sale. “The United States should be reimbursed or paid because without the United States they don’t have anything.” The president added: “It’s a little bit like the landlord-tenant. Without a lease, the tenant has nothing. So they pay what’s called key money, or they pay something.”

But there is no clear avenue for the government to collect a portion of the sale. The companies would probably have to pay standard fees and future tax revenue, but not a chunk of the sale price.

Microsoft is the leading contender to buy TikTok, in a deal that could remake the landscape of social media among the country’s major tech giants. It would give Microsoft a big competitive advantage to take on Facebook and Google’s YouTube.

Microsoft confirmed it is in talks to buy TikTok and had also previously identified Sept. 15 as the deadline for talks to conclude. Microsoft said in a blog post on Sunday that its chief executive had spoken to Trump about a potential deal, and the company seemed to working with the White House’s approval.

If Microsoft does buy TikTok, it would make sure all U.S. information is kept securely in the United States, it said.

Some experts have said Trump signed the TikTok order mostly to speed ByteDance into a deal to divest its U.S. operations.

“The whole thing strikes me as Trump trying to put pressure on TikTok,” said James Lewis of the Center for Strategic and International Studies. “I think it’s a big pressure campaign to get ByteDance to move in the right direction.”

Eva Dou in Seoul and Toluse Olorunnipa in Bridgewater, N.J., contributed to this report.