GithubHelp home page GithubHelp logo

Two factor authentication required. User have to enter a code from SMS or TOTP code generator to pass 2fac. about facebook-java-business-sdk HOT 4 CLOSED

Denalda-lab avatar Denalda-lab commented on April 27, 2024
Two factor authentication required. User have to enter a code from SMS or TOTP code generator to pass 2fac.

from facebook-java-business-sdk.

Comments (4)

stcheng avatar stcheng commented on April 27, 2024

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.

from facebook-java-business-sdk.

Denalda-lab avatar Denalda-lab commented on April 27, 2024

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:

        new Business.APIRequestCreateBusinessUser("181431399044864",FacebookUtil.createApiContext(request.getAccessToken()))
                .setEmail("[email protected]")
                .setRole(BusinessUser.EnumRole.VALUE_EMPLOYEE)
                .execute();

but it returns me:

{
"error": {
"message": "Application does not have permission for this action",
"type": "OAuthException",
"code": 10,
"error_data": {
"hash": null
},
"error_subcode": 2859030,
"is_transient": false,
"error_user_title": "This Action Is Not Allowed",
"error_user_msg": "Please retry this action in a few minutes",
"fbtrace_id": "AsErZRmD617WCt9yYFZkUZR"
}
}

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.

from facebook-java-business-sdk.

stcheng avatar stcheng commented on April 27, 2024

@Denalda-lab right now we do not provide an official way to generate system user access tokens programmatically. thanks for understanding.

from facebook-java-business-sdk.

Denalda-lab avatar Denalda-lab commented on April 27, 2024

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:

    new Business.APIRequestCreateBusinessUser("181431399044864",FacebookUtil.createApiContext(request.getAccessToken()))
            .setEmail("[email protected]")
            .setRole(BusinessUser.EnumRole.VALUE_EMPLOYEE)
            .execute();

My app has business_management permission (advanced access) and my user has an administrative role.

As a response I get:

{
"error": {
"message": "Application does not have permission for this action",
"type": "OAuthException",
"code": 10,
"error_data": {
"hash": null
},
"error_subcode": 2859030,
"is_transient": false,
"error_user_title": "This Action Is Not Allowed",
"error_user_msg": "Please retry this action in a few minutes",
"fbtrace_id": "AsErZRmD617WCt9yYFZkUZR"
}
}

from facebook-java-business-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.