django facebook app: Testing with Test Users? - django

I am creating a Facebook App. I would like to test this as real - or real-looking - test users.
How do I do this?
I know that it is possible to create test users via the code, but I have not seen examples of this using Python/Django. I'm also not really sure how to use these test users: can I log in with them for real via Facebook or what?
I would also like for me and a few friends to be able to add the App and test it, but without it being listed in the App Directory (I don't want anyone to stumble across it before it is ready). Is this possible?

Facebook provides an Open Graph API to create test users.
You can view the documentation here:
https://developers.facebook.com/docs/test_users/
How to create a test user (Your first question):
Get an app access token
https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&
grant_type=client_credentials
Or use the graph explorer https://developers.facebook.com/tools/explorer/
Or the access token tool: https://developers.facebook.com/tools/access_token/
Create the test user
https://graph.facebook.com/YOUR_APP_ID/accounts/test-users?installed=true&name=YOUR_DESIRED_TEST_USERNAME&permissions=DESIRED_PERMISSIONS_LIST&method=post&access_token=YOUR_APP_ACCESS_TOKEN
Or use the GUI manager for test users on the Open Graph section of your App management dashboard
https://developers.facebook.com/apps/YOUR_APP_ID/permissions
Choose "Add" under Test Users

1) Once you create the test users FB gives you a link you can use to log in, customize profiles and add photos, etc.
2) You can take a look at this CLI written in Python:
https://github.com/kcbanner/facebook-test-users
3) I am not sure, but I think you have a choice of whether to list or not list the facebook app in the directory. You can also limit access to certain users within your code by only allowing certain facebook ids access.

Related

Facebook API - how to get scope pages_manage_metadata

I created a messenger application for my clients. I need to get the scope "pages_manage_metadata" to be able to set webhook for their pages.
But test user can only get these scopes
https://i.stack.imgur.com/UG6r1.png
I cannot test my application on a test user and his page because the incoming messages are not working. I can not send an approval request and write how to use my application
Please tell me how to implement this function
Test users don’t work well for stuff that is related to pages. They can not interact with any “real” pages, only pages created by the test user account itself.
Use a real user account, that you add to a role in your app (admin/developer/tester; note that “tester” and “test user” are two different things), and use that account for your testing during development. If you don’t want to interfere with any live pages that user might be an admin of, then create a new page for your testing purposes first.

My website have only login with facebook feature, can I submit it for app review?

I made a website using Django.
The only way to log into it is the facebook login.
When I had to submit my app for review in the facebook developer console. They are asking me testing id and password. Since the only way to login is facebook, and it won't work till they test.
And they are asking how to open this website for testing. It's kind of a loop.
Is there another way out?
I don't want to use other ways of logging in (is in accordance with my idea)
I believe you can test your app with your own login credentials according to Facebook:
You do not need to submit your app if it will only be used in
Development Mode by you or someone with a role on your app. Any
account listed in the Roles tab in your App Dashboard, such as admins,
developers, and testers, can use all permissions but will only be able
to access their own data, that of test users, and test pages belonging
to them.
You can use any of these accounts to test your app and create a
screencast.
See this similar answer.

How to read Facebook Insights for a Native/Desktop app programmatically

Unfortunately I'm struggling to understand the documentation provided by Facebook.
This is the scenario:
- Some of my iPhone Apps are also registered as Native/Desktop Apps on Facebook in order to support the Facebook Audience Network.
- I'm building a tool in python which will retrieve data from the reporting API in order to run some automated analysis on specific metrics (request, impressions and so on).
The question is: how do I retrieve this data?
The documentation for the reporting API is here: Reporting API
However I'm struggling with the access token.
It says that I could use the specific App Token available here: App Tokens
However by using such token, I get an error saying that app tokens can't be used for Desktop/Native Ads.
What is the correct way to do it then? Here is where I struggle to understand Facebook Documentation.
My guess is that I should use a User Access Token instead, generated for a user that is also the admin of the App for which I want to retrieve the insights.
What really freaks me out is that apparently, this can't be done with normal HTTP calls only but it requires instead to go through the Facebook Login Dialog. I also need to create another Facebook (web) app because there is no way to get a simple "User Object"... Everything needs to start and go through a registered Facebook App. And there's no way to go through these steps by using backend code only.
So... to recap... in order to read the Insights for a Native/Desktop Facebook App (APP_A), I have to:
- Create a new Web Facebook App (APP_B)
- Create a web interface somewhere for APP_B) which will trigger the Facebook Login Dialog and request the read_insights permission.
- Login through this web interface and generate a User Access Token
- Put this User Access Token in my backend code and run the scripts that retrieve the data provided by the Reporting API for APP_B
Really... to me... it doesn't make any sense to create a new Facebook App in order to access the data of another Facebook App.
Isn't there another better, simpler, quicker, cleaner way to achieve the same final result?

Facebook Integration Static access token

I'm trying to use the facebook API on the backend of a website. Essentially, I want to be able to create events using a Djano app and have it create the corresponding facebook events.
The organization I am creating events for already have a facebook page. I only am concerned with posting events on that organization's page. I am the admin for the organization so I know all the login info.
What I am am trying to figure out is how I can setup the access token such thatit just works for the organization without any need to login to the facebook app. I was thinking that setting a static access token would do the trick, but I cannot find anyway to do it.
So, what is the standard way to create a facebook app that only interfaces with one predefined user?
Im not entirely sure what you're trying to do. However the static access token has now been deprecated. Do you want to: create an event for the person using the page, or for the company's page/profile?
Hope I can help

Using Graph to get a list of all my App IDs

Does anybody know if it possible to pull a list of the IDs for all the apps that I own in Facebook?
I know that each app has its own ID in the Graph (an example is here), but there doesn't appear to be connection between that and the ID of the Facebook user who created the app.
Basically, I need to script a management tool.
The app profile pages should be visible at /me/accounts when you use an access token with manage_pages permission - i'm not aware of any other way to retrieve a list of apps you admin