How to register a Facebook Application dynamically via Graph API like wildfireapp and others doing?

百般思念 提交于 2019-12-03 20:15:02
Mike Knoop

In general, they are likely not creating new applications for each client. Unless you can show us evidence of this, it is the same application being installed many times onto their client's Facebook Pages.

The application script can detect the Page ID and change the display logic appropriately. Seen here: Get Facebook fan page ID

If you really want to create applications for your clients, take a look at this thread: http://facebook.stackoverflow.com/questions/6264080/create-a-facebook-application-programmatically

EDIT (Not being able to comment is horrible) in response to J's post: There is not a way to create applications entirely programmatically, but you can get really close creating a user-flow around:

https://www.facebook.com/connect/create_app.php?api_key=[key]&name=app_name

Where [key] is the api_key of the parent application. It isn't documented anywhere so you should have a manual fall back in place. The link above does work to create a new Facebook application tied to the currently logged in user (the parent api_key does not seem to have any effect but it is required).

To determine the api_key of the application created, ask the user for the appropriate permission and query /accounts to retrieve a list of Facebook applications the user owns. Do this before and after the user clicks the above link to determine which one was just created. From there, have the user get a new access_token and get the appropriate permissions to modify application settings. You should then customize the newly created application.

Mike

This has been mentioned several times in the old Facebook forum.

Wildfire, North Social et al, do not create applications dynamically. It's the same application being installed by many clients.

How is this possible? Well, when a Page loads a tab application, Facebook pass you a signed_request parameter. When you decode this signed request with your application's id and secret, you will find inside the page id from where the tab application is being called. You can then use this to work out which of your clients is making the call to your code and therefore what content to deliver to the browser.

There have been changes to the Graph API recently to allow you to manage applications once created but you cannot (and likely will never be able to) create applications programmatically through the Graph API.

The second thread mentioned by Mike mentions child applications but this was deprecated from the Facebook code base some time ago and would not actually allow the creation of applications in the way I assume you want.

J

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!