• Basic Facebook Guide
" How to Install Facebook Farmville Games , Geting Facebook Marketplace App, How to Make Facebook Fan Page, Deleting All Facebook Searches History on FB , How to Login Instagram with Your Facebook , Facebook Marketplace Buy and Sell within Local Community Near Me , How to Deactivate FB Account Temporarily on Facebook, How to View Blocked Facebook List to Unblock blocked Friends , How to Use the “Nearby Me Friends” FB Feature on Facebook , Facebook Customer Care Center & Email Help Supports Contact Addresses "

Facebook Website Log In

 Facebook Website Log In, Website to log in Facebook     No comments   

                                              Facebook Website Log In
                                                 
 Facebook Website Log In



Facebook Login for the Web with the JavaScript SDK

Facebook Login with the Facebook SDK for JavaScript enables people to sign into your webpage with their Facebook credentials.

If for some reason you can't use our JavaScript SDK, you can also implement Facebook Login without it. To implement Facebook Login without the JavaScript SDK, see Manually Building a Login Flow.

Before you begin to implement Facebook Login with the JavaScript SDK, you need a Facebook App ID, which you can create and retrieve in the App Dashboard. You also need somewhere to host HTML files.

Implement Login with the following steps:
Enter Your Redirect URL to take people to your successful-loginpage.
Check the login status to see if someone's already logged into your app. During this step, you should also check to see if someone has previously logged into your app, but is not currently logged in.
Log people in, either with the login button or with the login dialog, and ask for a set of data permissions.
Log people out to allow them to exit from your app.

There is a full code example at the end of this topic.

1. Enter Your Redirect URL

In the App Dashboard, choose your app and go to Products > Facebook Login > Settings. Under the Client OAuth Settings, enter your redirect URL in the Valid OAuth redirect URIs field for successful authorization.

2. Check Login Status

The first step when loading your webpage is figuring out if a person is already logged into your app with Facebook Login. You start that process with a call to FB.getLoginStatus. That function will trigger a call to Facebook to get the login status and call your callback function with the results.

Taken from the sample code below, here's some of the code that's run during page load to check a person's login status:

FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});

The response object that is provided to your callback contains a number of friends.

status specifies the login status of the person using the app. The statuscan be one of the following:
connected - The person is logged into Facebook, and has logged into your app.
not_authorized - The person is logged into Facebook, but has not logged into your app.
unknown - The person is not logged into Facebook, so you don't know if they've logged into your app. Or FB.logout() was called before, and therefore, it cannot connect to Facebook.
authResponse is included if the status is connected and is made up of the following:
accessToken - Contains an access token for the person using the app.
expiresIn - Indicates the UNIX time when the token expires and needs to be renewed.
reauthorize_required_in - The amount of time before the login expires and reauthorization is required, in seconds.
signedRequest - A signed parameter that contains information about the person using the app.
userID - The ID of the person using the app.

Once your app knows the login status of the person using it, it can do one of the following:
If the person is logged into Facebook and your app, redirect them to your app's logged in experience.
If the person isn't logged into your app or isn't logged into Facebook, prompt them with the Login dialog with FB.login() or show them the Login Button.

3. Log People In

If people using your app aren't logged into your app or not logged into Facebook, you can use the Login dialog to prompt them to do both. Various versions of the dialog are shown below.

If they aren't logged into Facebook, they'll first be prompted to log in, then move on to logging in to your app. The JavaScript SDK automatically detects this, so you don't need to do anything extra to enable this behavior.

There are two ways to log someone in:
Use the Login Button.
Use FB.login() from the JavaScript SDK.

A. Log People in with the Login Button

Including the Login Button on your page is easy. For information on customizing the Login Button, see Login Button. To get the code for the basic button, enter the values you want in the following configurator and click Get Code.

Get Code

Note that the example at the end of this topic uses the onlogin attribute on the button to set up a JavaScript callback that checks the login status to see if the person logged in successfully:

<fb:login-button scope="public_profile,email" onlogin="checkLoginState();">
</fb:login-button>

This is the callback. It calls FB.getLoginStatus() to get the most recent login state. (The statusChangeCallback() function is part of the example that processes the response.)

As noted in the reference docs for this function, it results in a pop-up window showing the Login dialog, and therefore should only be invoked as a result of someone clicking an HTML button (so that the pop-up isn't blocked by browsers).

There is an optional scope parameter that can be passed along with the function call that is a comma-separated list of permissions to request from the person using the app. Here's how you would call FB.login()with the same scope as the Login Button we used above. In this case, it would ask for a person's email address and a list of friends who also use the app:

At this point in the login flow, your app displays the login dialog, which gives people the choice of whether to cancel or to enable the app to access their data.

Whatever choice people make, the browser returns to the app and response data indicating whether they're connected or if they cancelled is sent to your app. When your app uses the JavaScript SDK, it returns an authResponse object to the callback specified when you made the FB.login() call:

This response can be detected and handled within the FB.login call, like this:

4. Log People Out

You can log people out of your app by attaching the JavaScript SDK function FB.logout to a button or a link, as follows:


Note: This function call may also log the person out of Facebook.

Consider the 3 scenarios below:
A person logs into Facebook, then logs into your app. Upon logging out from your app, the person is still logged into Facebook.
A person logs into your app and into Facebook as part of your app's login flow. Upon logging out from your app, the user is also logged out of Facebook.
A person logs into another app and into Facebook as part of the other app's login flow, then logs into your app. Upon logging out from either app, the user is logged out of Facebook.

Additionally, logging out is not the same as revoking login permission (i.e., removing previously granted authentication), which can be performed separately. Because of this your app should be built in such a way that it doesn't automatically force people who have logged out back to the Login dialog.

Full Code Example

This code will load and initialize the JavaScript SDK in your HTML page. Use your app ID where indicated.

Now you can test your app by going to the URL where you uploaded this HTML. Open your JavaScript console, and you'll see the testAPI()function display a message with your name in the console log.

Congratulations, at this stage you've actually built a really basic page with Facebook Login. You can use this as the starting point for your own app, but it will be useful to read on and understand what is happening in the code above.

Related Posts:
  • How to post vote on Facebook
  • How to tell if someone has unfriended you on Faceb...
  • How to make vote in Facebook
  • I lost my fb password and Email
  • How to change email address on Instagram
  • My Facebook account Login Trouble
  • How to stop message requests on Facebook
  • Sign me up for Facebook
Additional Resources
Login Dialog

Facebook SDK for JavaScript Reference for FB.login()
Login Button

A simple way to trigger the Login Dialog.


Viewed using Just Read

Report an errorxPrint

Edit styles Facebook Website Log In
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Facebook has greatly reduced the distribution of our stories in our readers' newsfeeds and is instead promoting mainstream media sources. When you share to your friends, however, you greatly help distribute our content. Please take a moment and consider sharing this article with your friends and family. Thank you.

How to Install Facebook Marketplace Near Me App

How to Create a Facebook Business Page

How to Completely Delete Facebook Search History

How to Sign in or Login Instagram with Your Facebook

Marketplace Facebook Buy and Sell within Local Community – Marketplace Facebook Buy Sell App

How to Deactivate FB Account Temporarily on Facebook

How to Find Blocked Facebook List to Unblock blocked Friends

How to Use the “Near Me Friends” Facebook Feature

FB Customer Care Center & Email Help Supports Contact Addresses

How to Install & Play the Facebook Farmville Games
How to Install Facebook Marketplace Near Me App

How to Create a Facebook Business Page

How to Completely Delete Facebook Search History

How to Sign in or Login Instagram with Your Facebook

Marketplace Facebook Buy and Sell within Local Community – Marketplace Facebook Buy Sell App

How to Deactivate FB Account Temporarily on Facebook

How to Find Blocked Facebook List to Unblock blocked Friends

How to Use the “Near Me Friends” Facebook Feature

FB Customer Care Center & Email Help Supports Contact Addresses

How to Install & Play the Facebook Farmville Games

Blog Archive

  • ►  2019 (5)
    • ►  July (5)
  • ▼  2018 (2310)
    • ►  December (2)
    • ►  November (181)
    • ►  October (197)
    • ▼  September (1165)
      • Yahoo mail account sign up
      • Instagram video Icon
      • Add facebook widget to website
      • How to download facebook App
      • Terminate Facebook
      • Restart Facebook
      • How to search for Someone
      • Mobile number Lookup
      • Can you sign up for instagram online
      • Myphone Fb
      • Instagram login sign In
      • My facebook is blocked how do i unblock it
      • How to get more followers on instagram Instantly
      • Page Followers
      • Cannot get Facebook
      • Candy crush saga Android
      • How do i share from facebook to Instagram
      • How to change facebook username Again
      • Whatsapp turn off Facebook
      • Cannot get Facebook
      • Candy crush saga Android
      • How do i share from Facebook
      • how to change facebook username again
      • Whatsapp turn off Facebook
      • Can you hide friends from other friends on Facebook
      • Get off Facebook
      • Gearbox Facebook
      • How to download in facebook Videos
      • Find deleted facebook posts
      • Make your own poll free
      • How to delete list in Facebook
      • Meaning of poke in hindi on Facebook
      • Free online video downloader from any Site
      • Facebook update Verion Download
      • Who viewed my Facebook
      • Facebook logout link Mobile
      • How to delete your old instagram account without P...
      • Our facebook Page
      • Pages for You
      • Facebook new id open Now
      • Can you make a poll on Facebook Page
      • Pet friendly Hotels
      • Goggles
      • Where do you find archived messages on Facebook
      • Facebook blank Page
      • How i change my name in Facebook
      • Unblockedgamescorner
      • How do i delete a group i created on Facebook
      • Forgot Instagram password and Dont have Facebook
      • British army Facebook
      • How to change page url in Facebook
      • Vacation countdown Widget
      • my facebook is blocked how do i unblock it ...
      • Email id login
      • Sign in facebook sign in
      • Mobile facebook Messenger
      • Suspend facebook Page
      • Facebook at work sign up
      • can plus
      • face messenger app
      • How to read archived Facebook Messages
      • www f facebook com login
      • Memories of Facebook
      • Erase Facebook account Forever
      • Download a Messenger App
      • Retrieve lost facebook Password
      • Facebook login friends Search
      • quiz de facebook
      • Poke Poke
      • Fb logout Button
      • How to change name on Facebook before 60 Days
      • How to permanently delete Facebook messages from f...
      • can Instagram
      • How we delete Facebook Account
      • What is followers in Facebook
      • How to convert facebook video to Mp3
      • How to get ur Instagram Password
      • Download Instagram for Tablet
      • How do i know if someone has Facebook Messenger
      • Where can i find location services on Iphone
      • No name Facebook
      • How to unblock ads on Facebook
      • Download foto instagram online
      • How to find a Facebook Stalker
      • Aquarius horoscope Today
      • Facebook login through mobile Number
      • Instagram deleted my Likes
      • Fb sign in and log In Password
      • Delete location on Facebook
      • Log in Facebook Facebook
      • How to unblock ppl on Fb
      • Facebook messenger recovery Tool
      • Facebook operator Number
      • How to know block Facebook
      • Facebook operator Number
      • How to know block Facebook
      • Fejsbuk Log in
      • How to hide Facebook friends list on Mobile
      • How to logout of Instagram on Laptop
      • Can i see who views my Instagram Pictures
    • ►  August (665)
    • ►  July (100)

Copyright © Basic Facebook Guide