The Giants won their second world championship in three years in October, beating the Detroit Tigers 4-3 in the final game after nearly being knocked out of the playoffs several times.
“It’s no wonder that your own fans still refer to Giants baseball as torture,” Obama joked.
In 2010, the Giants beat the Texas Rangers 4-1 to win their first World Series since 1954.
Before the ceremony, Obama privately told team officials he's counting on a comeback this season, too, the San Francisco Chronicle reported.
"You guys are a second-half team. I expect you to be a second-half team this time around," he said.
The president attributed the two championships to "stellar pitching and smothering defense and timely hitting," noting some changes from the players' last visit to the White House including new nicknames -- the "Reverend" Hunter Pence and "Blockbuster" second baseman Marco Scutaro. And, of course, pitcher Tim Lincecum's new haircut.
"Where’s Tim?" he said. "There he is. See, you don't even recognize him anymore."
Obama also congratulated Bruce Bochy, who last week became one of 21 managers to reach 1,500 wins.
San Francisco Mayor Ed Lee, House Minority Leader Nancy Pelosi (D-Calif.) and former Giants great Willie Mays -- “the Say Hey Kid” -- also attended the event.
In addition to their championships, the president recognized the team for its work in the community with Junior Giants, a free, noncompetitive league that serves more than 20,000 kids. The team also was honored for its support of the LGBT community, and two years ago was the first professional sports franchise to create an “It Gets Better” video for LGBT youths, the president noted.
Next year, the team will turn the center-field bleachers into what is believed to be the first edible garden in a major sports facility, Obama said, with kale, strawberries and eggplant.
“I should add, even Michelle would say it's OK to have a hot dog once in a while, though,” he said. ”I don’t want everybody to get carried away and think they have to have kale every time they go to the ballpark.”
The Giants' Twitter feed sent out updates and photos from the event: