Protect your Facebook account from hackers with two-factor authentication

Don't be one of those people with a compromised account that spams all their friends.

Nobody likes it when their friends suddenly start spewing links to weight-loss supplements and porn on Facebook. Don't be that person. Using Facebook's two-factor authentication feature can help keep undesireables out of your account--perhaps saving some friendships.

Two-factor authentication, for the uninitiated, requires you to enter in another piece of private data in addition to your password in order to log in. This typically takes the form of a single-use security code that gets sent to your smartphone, and it can help keep your account safe in case a hacker or data thief ever gets ahold of your username and password.

To start, visit and log in with your username and password. Next click the gear icon in the upper right corner, and select Account Settings from the menu that pops up. On the next screen, select Security from the list on the left, then select Login Approvals. When the Login Approvals section expands, check the box labelled Require a security code to access my account from unknown browsers, and Facebook will walk you through the setup process.

By default, Facebook will send security codes through its mobile app, but it can send you text messages as a backup login method. If you don't already have a cellphone number associated with your account, Facebook will ask you to add one. When prompted, select your country from the list, enter your number, then press Continue. Facebook will send you a text message to confirm that your number is indeed yours: Enter the six-digit confirmation code texted to you when prompted, then click Confirm.

Logging in

Facebook will not pester you to enter a security code from a browser it already recognizes, so if you only use Facebook from one computer, you may never be asked to senter a security code. But if you are, here's what to expect:

The next time you log into Facebook on a new computer, enter your username and password as usual, then press Log In. On the next screen, Facebook will ask you to enter a security code.

To get that code, open the Facebook app on your phone, tap More (in the toolbar on iOS, swipe left to right to access the More menu on Android), then scroll down and tap Code Generator. Facebook will give you a single-use code that's good for 30 seconds (after 30 seconds, you'll be get a new code). Enter this in on your computer, then press Continue.


Facebook's two-factor authentication feature won't protect everything, though. It only asks for a security code if you attempt to log in from an unrecognized device, and it only works for login requests from Web browsers--you can log into the Facebook mobile app without having to enter a code. Still, it's better than nothing.

Join the CSO newsletter!

Error: Please check your email address.

Tags Internet-based applications and servicesWeb & socialsecurityAccess control and authenticationsocial networkinginternetFacebook

More about Facebookindeed

Show Comments

Featured Whitepapers

Editor's Recommendations

Solution Centres

Stories by Nick Mediati

Latest Videos

  • 150x50

    CSO Webinar: The Human Factor - Your people are your biggest security weakness

    ​Speakers: David Lacey, Researcher and former CISO Royal Mail David Turner - Global Risk Management Expert Mark Guntrip - Group Manager, Email Protection, Proofpoint

    Play Video

  • 150x50

    CSO Webinar: Current ransomware defences are failing – but machine learning can drive a more proactive solution

    Speakers • Ty Miller, Director, Threat Intelligence • Mark Gregory, Leader, Network Engineering Research Group, RMIT • Jeff Lanza, Retired FBI Agent (USA) • Andy Solterbeck, VP Asia Pacific, Cylance • David Braue, CSO MC/Moderator What to expect: ​Hear from industry experts on the local and global ransomware threat landscape. Explore a new approach to dealing with ransomware using machine-learning techniques and by thinking about the problem in a fundamentally different way. Apply techniques for gathering insight into ransomware behaviour and find out what elements must go into a truly effective ransomware defence. Get a first-hand look at how ransomware actually works in practice, and how machine-learning techniques can pick up on its activities long before your employees do.

    Play Video

  • 150x50

    CSO Webinar: Get real about metadata to avoid a false sense of security

    Speakers: • Anthony Caruana – CSO MC and moderator • Ian Farquhar, Worldwide Virtual Security Team Lead, Gigamon • John Lindsay, Former CTO, iiNet • Skeeve Stevens, Futurist, Future Sumo • David Vaile - Vice chair of APF, Co-Convenor of the Cyberspace Law And Policy Community, UNSW Law Faculty This webinar covers: - A 101 on metadata - what it is and how to use it - Insight into a typical attack, what happens and what we would find when looking into the metadata - How to collect metadata, use this to detect attacks and get greater insight into how you can use this to protect your organisation - Learn how much raw data and metadata to retain and how long for - Get a reality check on how you're using your metadata and if this is enough to secure your organisation

    Play Video

  • 150x50

    CSO Webinar: How banking trojans work and how you can stop them

    CSO Webinar: How banking trojans work and how you can stop them Featuring: • John Baird, Director of Global Technology Production, Deutsche Bank • Samantha Macleod, GM Cyber Security, ME Bank • Sherrod DeGrippo, Director of Emerging Threats, Proofpoint (USA)

    Play Video

  • 150x50

    IDG Live Webinar:The right collaboration strategy will help your business take flight

    Speakers - Mike Harris, Engineering Services Manager, Jetstar - Christopher Johnson, IT Director APAC, 20th Century Fox - Brent Maxwell, Director of Information Systems, THE ICONIC - IDG MC/Moderator Anthony Caruana

    Play Video

More videos

Blog Posts

Market Place