New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Two factor authentication required. User have to enter a code from SMS or TOTP code generator to pass 2fac. #438
Comments
This happens due to an enforcement on requiring 2fa on generating system user tokens. Right now the only workaround for developers is to generate the access token from the UI: https://business.facebook.com/settings/system-users or you could try to generate access tokens on non system users. |
Hello @stcheng Thank you for the response. I can not use an access token of a non system user. I want to invite a user to an existing facebook business account:
but it returns me: { My App and the access token I am using have the right permission to execute this action. My app has business_management permission (advanced access) and my user has an administrative role, which means I am able to invite the exact new user to the same business manager via facebook ui. After some investigations I figured out that I can successfully execute the action if using an admin system user access token instead. Now I need to generate a system user access token programmatically. |
@Denalda-lab right now we do not provide an official way to generate system user access tokens programmatically. thanks for understanding. |
Thank you for the response @stcheng! My last tentative: Is it any way to invite a user to join a business account by using an admin access token instead of an admin system user access token? As I have mentioned above I try to make a call as below:
My app has business_management permission (advanced access) and my user has an administrative role. As a response I get: { |
Which SDK version are you using?
What's the issue?
I am trying to generate an access token for admin user system with id 100034358611019. Instead of returning the access token I get an error response related with 2FA:
{
"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.",
"type": "OAuthException",
"code": 415,
"error_data": {
"hash": "8874359819718335175"
},
"error_subcode": 2859009,
"is_transient": false,
"error_user_title": "Two-factor authentication required",
"error_user_msg": "To continue working in your account, please refresh this page to authenticate. Or navigate to the business settings page and authenticate when prompted.",
"fbtrace_id": "AwfkZm6RouSgmnWYNFln2q1"
}
}
Steps/Sample code to reproduce the issue
new User.APIRequestCreateAccessToken("100034358611019", FacebookUtil.createApiContext(accessToken))
.setBusinessApp("2990249911190581")
.setScope("business_management").execute();
And gets the 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. To continue working in your account, please refresh this page to authenticate. Or navigate to the business settings page and authenticate when prompted.
Expected Results:
Can somebody tell me what's the problem behind this?
The text was updated successfully, but these errors were encountered: