Login Desktop App
From Facebook Developers Wiki
[edit] Logging a User into a Desktop Application
This article provides a high level view of the login process for a desktop application.
First, create an auth_token by calling auth.createToken. This example seems to doesn't work anymore. Please Facebook update this page.
| include_once 'facebookapi_php5_restlib.php'; $server_url = 'http://api.facebook.com/restserver.php'; // Fill in your API key and secret. $api_key = 'YOUR_API_KEY'; $secret = 'YOUR_SECRET'; $client = new FacebookRestClient($server_url, $api_key, $secret, null, true); $result = $client->auth_createToken(); $auth_token = $result['token']; |
Your desktop application may look something like this (see below for a sample login button).
Using the auth_token returned from auth.createToken, redirect the user to the following URL in a Web browser, to log in to Facebook. http://www.facebook.com/login.php?api_key=YOUR_API_KEY&v=1.0&auth_token=abc123
If the user is not already logged into Facebook, the user will be directed to a page like this:
If the user has never logged into your application before, she'll be asked to accept the Terms of Service for using the application. These are your Terms of Service, not Facebook's. If the user has already accepted the Terms of Service, she skips this step.
If the user has used your application before, she'll be taken directly to the "logged in" page.
The user is now successfully logged into the application.
For more detailed information about the login procedure, see the authentication guide.
[edit] Facebook Login Image
You may use this image to display on your site as a link or login to Facebook.
Please note that you may only use the Facebook name (or any of our other trademarks) in accordance with the Facebook Platform Terms of Service. You will likely format the button like this:
| <a href="http://www.facebook.com/login.php?api_key=YOUR_API_KEY&v=1.0&auth_token=abc123"><img src="http://static.ak.facebook.com/images/devsite/facebook_login.gif"></a> |




