Hillary Clinton had to eat humble pie twice on election night.

Clinton apologized to President Obama for her bruising loss — right after calling Trump to offer him “congratulations,” according to a new book chronicling her 2016 presidential bid called “Shattered: Inside Hillary Clinton’s Doomed Campaign.”

“Mr. President, I’m sorry,” she said, according to the Washington Post’s review of the book, due out Tuesday.

The White House urged Clinton to concede as Trump claimed battleground states — some by slim margins — because Obama wanted to avoid a messy recount.

“You need to concede,” Obama told Clinton directly, later repeating the instruction to her campaign chairman John Podesta for good measure.

The directive came after Clinton ignored previous messages from White House staff to throw in the towel.

She conceded the loss publicly the next morning.

Click for more from the New York Post.