vue-facebook-signin-button

by phanan

A simple plugin to include a custom Facebook sign-in button into your web app.

128 Stars 31 Forks Last release: Not found 5 Commits 1 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

vue-facebook-signin-button

A simple Vue plugin to include a custom Facebook sign-in button into your web app.

Screenshot

Install

This plugin can be installed as a module

$ npm install vue-facebook-signin-button

or, if you're not in a modular environment, just include it as a

.

Usage

Important: The Facebook SDK must first be loaded asynchronously for the plugin to work. Something like this will do:

js
  window.fbAsyncInit = function() {
    FB.init({
      appId      : '{your-app-id}',
      cookie     : true,  // enable cookies to allow the server to access the session
      xfbml      : true,  // parse social plugins on this page
      version    : 'v2.8' // use graph api version 2.8
    });
  };
  (function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));

Step 1:

import
and
use
the plugin if you're in a modular environment (you don't need this step otherwise, as the plugin will register itself).
import FBSignInButton from 'vue-facebook-signin-button'
Vue.use(FBSignInButton)

Step 2: Now you have a

fb-signin-button
global component, ready for use. It's best to demonstrate the usage with an example:


That's it!

Looking for the Google counterpart?

License

MIT © Phan An

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.