Robert Collins ... had no option but to give his Facebook username and password. Photo: AP

When Justin Bassett interviewed for a new job, he expected the usual questions about experience and references. So he was astonished when the interviewer asked for something else: his Facebook username and password.

Bassett, a New York City statistician, had just finished answering a few character questions when the interviewer turned to her computer to search for his Facebook page. But she couldn't see his private profile. She turned back and asked him to hand over his login information.

Bassett refused and withdrew his application, saying he didn't want to work for a company that would seek such personal information. But as the job market steadily improves, other job candidates are confronting the same question from prospective employers, and some of them cannot afford to say no.

In their efforts to vet applicants, some companies and government agencies are going beyond merely glancing at a person's social networking profiles and instead asking to log in as the user to have a look around.

"It's akin to requiring someone's house keys," said Orin Kerr, a George Washington University law professor and former federal prosecutor who calls it "an egregious privacy violation."

Questions have been raised about the legality of the practice, which is also the focus of proposed legislation in Illinois and Maryland that would forbid public agencies from asking for access to social networks.

Since the rise of social networking, it has become common for managers to review publicly available Facebook profiles, Twitter accounts and other sites to learn more about job candidates. But many users, especially on Facebook, have their profiles set to private, making them available only to selected people or certain networks.

Companies that don't ask for passwords have taken other steps — such as asking applicants to friend human resource managers or to log in to a company computer during an interview. Once employed, some workers have been required to sign non-disparagement agreements that ban them from talking negatively about an employer on social media.

Asking for a candidate's password is more prevalent among public agencies, especially those seeking to fill law enforcement positions such as police officers or 911 dispatchers.

Back in 2010, Robert Collins was returning to his job as a correctional officer at the Maryland Department of Public Safety and Correctional Services after taking a leave following his mother's death. During a reinstatement interview, he was asked for his login and password, purportedly so the agency could check for any gang affiliations. He was stunned by the request but complied.

"I needed my job to feed my family. I had to," he recalled.

After the ACLU complained about the practice, the agency amended its policy, asking instead for job applicants to log in during interviews.

"To me, that's still invasive. I can appreciate the desire to learn more about the applicant, but it's still a violation of people's personal privacy," said Collins, whose case inspired Maryland's legislation.

Until last year, the city of Bozeman had a long-standing policy of asking job applicants for passwords to their email addresses, social-networking websites and other online accounts.

And since 2006, the McLean County sheriff's office has been one of several Illinois sheriff's departments that ask applicants to sign into social media sites to be screened.

Chief Deputy Rusty Thomas defended the practice, saying applicants have a right to refuse. But no one has ever done so. Thomas said that "speaks well of the people we have apply."

When asked what sort of material would jeopardise job prospects, Thomas said "it depends on the situation" but could include "inappropriate pictures or relationships with people who are underage, illegal behavior."

In Spotsylvania County, the sheriff's department asks applicants to friend background investigators for jobs at the 911 dispatch centre and for law enforcement positions.

"In the past, we've talked to friends and neighbours, but a lot of times we found that applicants interact more through social media sites than they do with real friends," said Captain Mike Harvey. "Their virtual friends will know more about them than a person living 30 yards away from them."

Harvey said investigators look for any "derogatory" behavior that could damage the agency's reputation.

E Chandlee Bryan, a career coach and co-author of the book The Twitter Job Search Guide, said job seekers should always be aware of what's on their social media sites and assume someone is going to look at it.

Bryan said she is troubled by companies asking for logins, but she feels it's not a violation if an employer asks to see a Facebook profile through a friend request. And she's not troubled by non-disparagement agreements.

"I think that when you work for a company, they are essentially supporting you in exchange for your work. I think if you're dissatisfied, you should go to them and not on a social media site," she said.

More companies are also using third-party applications to scour Facebook profiles, Bryan said. One app called BeKnown can sometimes access personal profiles, short of wall messages, if a job seeker allows it.

Sears is one of the companies using apps. An applicant has the option of logging into the Sears job site through Facebook by allowing a third-party application to draw information from the profile, such as friend lists.

Sears spokeswoman Kim Freely said using a Facebook profile to apply allows Sears to be updated on the applicant's work history.

The company assumes "that people keep their social profiles updated to the minute, which allows us to consider them for other jobs in the future or for ones that they may not realize are available currently," she said.

Facebook declined to comment except for issuing a brief statement declaring that the site forbids "anyone from soliciting the login information or accessing an account belonging to someone else."

Giving out Facebook login information also violates the social network's terms of service. But those terms have questionable legal weight, and experts say the legality of asking for such information remains murky.

The Department of Justice regards it as a federal crime to enter a social networking site in violation of the terms of service, but during recent congressional testimony, the agency said such violations would not be prosecuted.

Lori Andrews, a law professor at IIT Chicago-Kent College of Law specializing in Internet privacy, is concerned about the pressure placed on applicants, even if they voluntarily provide access to social sites.

"Volunteering is coercion if you need a job," Andrews said.

Twitter did not respond to repeated requests for comment.

In New York, Bassett considered himself lucky that he was able to turn down the consulting gig at a lobbying firm.

"I think asking for account login credentials is regressive," he said. "If you need to put food on the table for your three kids, you can't afford to stand up for your belief."