Correct way to get token key for Facebook API

I usually use the dirty method to get the Facebook Graph API token key in apps that fetch facebook data. I load the dot facebook dot com graph API example page then I find the marker key on the page. (Account is already connected)

Now I need to program (for someone else) a commercial application that uses the Graph API, and I'm afraid this hacky way might become non-functional if the Facebook site changes.

Is there a static url more common than the example page that contains the Graph API token_key object, or do you think my method will be safe for a long time to come?

[change]

Just to comment on my question and answer my question:

I was trying to create a desktop app fetching data on Facebook using only the "Graphical Explorer" page and the example "Graph" page instead of making a request in the response. I didn't want to have a desktop app that depends on a Facebook app, so I always asked the user to connect via two textboxes (which contradicts Facebook t & c), after which I downloaded the Graph API examples page to get the corresponding token.

But Graph Explorer and its examples also use the Facebook app. Thus, it is not clear if the access_token will be valid for a long time or not: this is not a good practice.

Answer: redirecting the user to the authentication page, retrieving the access token is more secure, easy to handle, and much more stable than connecting the user through text fields and multiple web browsers.

+3


source to share


1 answer


You can get an Application Access Token to request public data on Facebook at this URL:

https://graph.facebook.com/oauth/access_token?type=client_cred&client_id={yourappid}&client_secret={yourappscret}



You need to create an application on Facebook and transfer its ID and secret key.

More information: http://developers.facebook.com/docs/authentication/applications/

+3


source







All Articles