Get all information of a facebook page - json

I would like to recover the non-public information to a facebook page for an application "desktop" in C # and I do not know how. Do I have to go through a Facebook application that the user allow or do I get the Facebook user to have a access_token and display the page based on this one? FYI I use graph (and a JSON) that I get, I picked up this version as the "public" group:
https://graph.facebook.com/283774678311430

Do I have to go through a Facebook application that the user allow
Yes, you need an application to let the user give access to view the page or have the page owner give access
do I get the Facebook user to have a access_token and display the page based on this one?
Same answer, use the page owner as the user call /me/accounts and grab the page access token.

Related

Is it good idea to authenticate every page of my website?

I am currently using JSON Web Token to authenticate every page of my website except homepage. The idea is to generate token on login/registration with the user's MongoDB id and save that into cookies. Then whenever user tries to open any page, first token will be decoded and then id will be matched with the database records to verify that the correct user is trying to access page.
I haven't launched the website yet. My question is, is it a good practice to access database before every page loads for user or will it slow down my website once more users start coming on website?

How to access my own news feed and videos, photos I share?

I'm just making a simple widget where I can display my facebook feed as customized, like grid view.
When I was submitting for app review, there was so much permission when it was my own feed only. I have no plans for visitors to like login into my site. It's just my own feed on my site on grid view.
Are there other simple ways to do this rather than graph API? Simply to get my facebook feed as JSON.
If it is just for your own account, you do not need review. Review is only neccessary if you want to enable other users to use your App - or, for example, if you want to get data of Pages you do not own.
Just use a User Token with the correct permissions to get your account data with the Graph API.

conditional display of data in asp.net mvc layout

In an ASP.NEt MVC application, how is it possible to display some conditional data to a layout page?
My application allows a user with a role of "Admin" to view the other user's pages and data from the same application. When the Admin views the pages of another user he/she needs to see the information of the user like his name/role/etc whose data he/she is viewing ( this information comes from the DB) . This info needs to be shown in all the pages when an Admin User is logged in and ONLY when an ADmin is logged in. i.e, if a user who is not Admin enters these details should not be shown as it is not relevant.
The issue iam facing in my attempts is that the Admin user does not login to the user's page, instead I have to achieve this feature of switching to the users view by clicking on a list/grid of users. This takes me to the home page of the user (and i get the inforamtion displayed since i set it in viwbag) .Question is, how do i set this value in the subsequent user pages of this session. Trying to avoid filling this viewbag value in every controller/action.
Please help!
PS: The information that needs to be displayed in the layout is based on the user's ID that the Admin selects from the grid. It commes from the DB.
You could write the user id to a cookie and use a action filter to check for this cookie on requests done by the admin user

Facebook photo name showing on website

How can I get the user's photo and name to show on my website and save them in MySQL?
This can be simply achieved by querying Graph API with id of user
http://graph.facebook.com/USER_ID?fields=name,picture
Results will contain name of the user and URL to his picture
you need to get permission from user that uses your application.
once you have user_photos permision you can do whatever you want.
you can find all permission in here: extended permission: https://developers.facebook.com/docs/authentication/permissions/#extended_perms
and look out here:
https://developers.facebook.com/docs/reference/api/photo/
Juicy is right that you can get that information. Turgut is not right about the authorisation as you can actually get that information for anyone if you know their Facebook Id. And therein lies the issue. If you are in a facebook app then facebook will post the user's id with the request for each page within the request object. But outside of facebook iframe apps you will need a way to query the users id. this can be done using the Facebook javascript api.
Here is some further reading:
http://developers.facebook.com/docs/reference/api/
http://developers.facebook.com/tools/explorer/?method=GET&path=735915914
http://developers.facebook.com/docs/authentication/canvas/
visiting users Facebook ID w/out authorization?

Add application to Fb Page from outside Fb, add tab for it and configure if with specific data?

I have a simple product catalogue for businesses. There is a catalogue's management interface for adding products. Each business has a unique domain name where all its products are listed.
I would like to extend catagloue's functionality and allow businesses to have their products listed on facebook.
Functionality of the facebook application:
- Each business can install application from catalogue's management interface (I would like to have a button that opens facebook in a new window and prompts user to authorize access to one of user's existing Facebook Pages)
- installing application adds a Tab on selected Facebook Page,
- by clicking on a Tab visitor of the Facebook Page is presented with a list of products specific for this business. Data for that page is dynamic and can be accessed with a REST call and presented as json or html.
We would like each business that have a product catalogue with us to install application and have it automatically configured to use specific domain name when requesting product data.
Is it all technically possible? Could you point me into the right direction on how to
- install application from external website
- configure that application with a parameter (perhaps passed in url when requesting application installation)
- automatically add Page Tab for this application
Cheers,
Michal
Yes it is possible. But it'll be a little different from what you are thinking, i guess.
I recently implemented code to add a tab to a page programmatically, it is as follows(in PHP) :
$tabAdded=$facebook->api("/".$id."/tabs","post", array("access_token" => $access,
"app_id" => $fbconfig['appid']));
From the code we see that we need an app id, an access token, and the page id($id). $facebook is an instance of the FacebookPHPSDK.
So here's how we can get the three things in question:
First app id, you'll need to create a Facebook page tab app, select Page Tab in the app's Basic settings (where you can mention the page tab url. This url will have the content for a page tab.) You'll also need to enable website because you need to ask the user for necessary permissions (namely manage_pages). For your specific requirement you have to give the domain of the catalogue management app.
Second page id and access token, once you have manage_pages permission you can query the graph api to get the pages of the user using : api('me/accounts') this returns data with page name, page category, page id, page access token for all the user's pages.
#thaddeusmt has already mentioned that you can't create new applications, and need to use the same app, you have to read the signed request and get the page id, and serve content. All that will be left to do is link your customer domains to the correct page ids.
Hope this was useful.
You can install/uninstall (add/remove) application tabs to/from Pages using the Facebook API:
http://developers.facebook.com/docs/reference/api/page/#tabs
You cannot create new applications, however. So you will need to use the same application for each Page.
The way you can show different content for each Page in the Tab (using the same application) is by checking the Signed Request. This contains the ID of the Facebook Page. The code that serves up your application Tab can look at the Page ID and serve up the appropriate content for that Page.
I hope this helps get you on the trail. Good luck!
Yes it is possible.
It's a two way process
First you have to get page_access_token through graphAPI.
www.facebook.com/?fields=access_token
This will return Page_access_token.
Use page access token and use post method
www.facebook.com/yourpageid/tabs/
Post Parameters:
app_id= 'YourAppID'
access_token = 'access_token'
That way you can add your facebook app into facebookPage.