SEATTLE: When Mr Justin Bassett attended an interview 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.

Mr Bassett refused to comply and withdrew his application, saying he did not want to work for a company that would seek such personal information. But as the US 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 George Washington University law professor Orin Kerr, a 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 do not 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, Mr Robert Collins was returning to his job as a correctional officer at the Maryland Department of Public Safety and Correctional Services after taking 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 said.

After the American Civil Liberties Union 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 Mr Collins, whose case inspired Maryland's proposed legislation.

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'.