Whether someone is not logged into your app or not logged into Facebook, you can use to prompt them to do both. If they aren't logged into Facebook, they'll be prompted to login and then move onto logging into your app. This is automatically detected, so you don't need to do anything extra to enable this behavior. Invoking the Login Dialog and Setting the Redirect URLYour app must initiate a redirect to an endpoint which will display the login dialog: https://www.facebook.com/ This endpoint has the following required parameters:
For example, if your login request looks like: https://www.facebook.com/ then your redirect URI would be called with this: https://www.domain.com/login?state="{st=state123abc,ds=123456789}" It also has the following optional parameters:
For Windows 8 AppsIf you are building Login for a Windows app you can use the Package Security Identifier as your https://www.domain.com/login?state="{st=state123abc,ds=123456789}"2 and use the Login Dialog endpoint as the requestUri. Here is an example in JavaScript: var requestUri = new Windows.Foundation.Uri(
"https://www.facebook.com/ This will return control flow back to your app with an access token on success, or error on failure. Handling Login Dialog ResponseAt this point in the login flow, the person will see the Login dialog and will have a choice of whether to cancel or to let the app access their data. If the person using the app chooses OK on the Login dialog, they grant access to their public profile, friend list and any additional Permissions your app requested. In all cases, the browser returns to the app, and response data indicating whether someone connected or cancelled is included. When your app uses the redirect method as above, the https://www.facebook.com/ 0), which must be captured.Because of the various combinations of code languages that could be used in web apps, our guide doesn't show specific examples. However most modern languages will be capable of URL parsing, as follows: Client-side JavaScript can capture URL fragments (for example jQuery BBQ), whereas URL parameters can be captured by both client-side and server-side code (for example https://www.domain.com/login?state="{st=state123abc,ds=123456789}"5 in PHP, https://www.domain.com/login?state="{st=state123abc,ds=123456789}"6 in jQuery BBQ, https://www.domain.com/login?state="{st=state123abc,ds=123456789}"7 in Node.js or https://www.domain.com/login?state="{st=state123abc,ds=123456789}"8 in Python). Microsoft provides a guide and sample code for Windows 8 apps connecting to an "online provider" - in this case, Facebook. When using a desktop app and logging in, Facebook redirects people to the https://www.facebook.com/connect/login_success.html# access_token=ACCESS_TOKEN... Your app needs to detect this redirect and then read the access token out of the URI using the mechanisms provided by the OS and development framework you are using. You can then skip straight to the step. Canceled LoginIf people using your app don't accept the Login dialog and clicks Cancel, they'll be redirected to the following: |