Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Facebook OAuth2 with 2FA

Is there a way to add 2FA to Facebook's Oauth2 flow? The following error is returned when trying to hit the graph API's insights endpoint for a user that has 2FA enabled on their FB Business Manager account:

"error": {
    "fbtrace_id": "HrY8K9KfT4U",
    "error_user_msg": "Unknown error",
    "message": "Two factor authentication required. User have to enter a code from SMS or TOTP code generator to pass 2fac. This could happen when accessing a 2fac-protected asset like a page that is owned by a 2fac-protected business manager.",
    "error_subcode": 1404120,
    "type": "OAuthException",
    "error_user_title": "Ask user to pass two factor authentication",
    "is_transient": false,
    "code": 415
  }
like image 679
Nick McCoy Avatar asked Aug 22 '18 13:08

Nick McCoy


1 Answers

I've seen this issue a couple of times and the problem usually extends from the Business Manager having two-factor authentication enabled, but the user making the API calls does not have two-factor authentication enabled on their account.

In all the cases I've seen, having the user enable two-factor authentication on their account, and pass through the 2-fac login flow has fixed the issue for the user.

like image 122
Devesh mehta Avatar answered Oct 18 '22 18:10

Devesh mehta