A Philadelphia Starbucks has apologized to a police officer after one its baristas allegedly told a uniformed police officer he was not allowed to use the restroom because he was not a paying customer.

The officer posted a status to Facebook, explaining what happened, claiming that when he asked for the key code to use the restroom, the female employee at the front counter refused to give him the code for the door.

The company's corporate office has since commented, saying 'This customer's experience is not consistent with the welcoming and friendly environment we strive to create for everyone.'

No cops allowed: Starbucks has apologized to a Philadelphia police officer whose saga of being denied access to the restroom at one of the chain's downtown stores went viral

Fellow officer: The unnamed sergeant's rant was posted to the Starbucks' Facebook page Friday by Joe Leighthardt (pictured) , another Philadelphia police officer, and has been shared more than 20,000 times since

The social media post tended up going viral over the weekend. A spokesperson for the international coffee shop chain has since apologized to the police sergeant for the incident, which happened on September 11th, last week.

The sergeant, according to the posting walked into the Starbucks at 13th and Chestnut streets in downtown Philly and asked for the key code to use the restroom.

An employee, according to the posting: 'stated in a loud voice ... that the bathroom is for paying customers only.'

'While she continued loudly to tell me about the bathroom down the street, I was even more astonished that the many customers and other employees said nothing and seemed indifferent.

'This is the world cops live in anymore,' wrote the sergeant, who has declined to comment, saying he didn't anticipate that his post would gain such traction.

No loo for you!The sergeant lashed out online after a worker refused to give him the key code to the bathroom because he wasn't a paying customer

According to his account, 'the young blonde liberal behind the counter,' smirked and loudly asked him, 'Are you a paying customer?'

As he was on his way out, the employee told him about other restroom options nearby.

The officer wrote that he viewed her behavior as evidence of a larger trend: 'It's hip for this generation to berate and totally disrespect cops in front of the public and praise cop killers as the heroes of they're time.'

Officer Joe Leighthardt, a friend of the sergeant, was the first to share the fellow officer's post about the incident.

Double standards: In his post on Starbucks' Facebook page, Leighthardt noted that the store frequently calls police 'for some sort of service'

Leighthardt said he personally has been to that Starbucks location several times on calls for service, but never as a customer.

'I didn't intend for it to go viral,' Leighthardt said, adding that most people who have responded to the post have been supportive.