All Projects → phanan → Vue Facebook Signin Button

phanan / Vue Facebook Signin Button

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

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Vue Facebook Signin Button

Vim Qfreplace
Perform the replacement in quickfix.
Stars: ✭ 121 (-4.72%)
Mutual labels:  plugin
Sportspress
An open source league statistics plugin for WordPress created by ThemeBoy.
Stars: ✭ 124 (-2.36%)
Mutual labels:  plugin
Plugins
go-flutter implementations for popular Flutter plugins
Stars: ✭ 125 (-1.57%)
Mutual labels:  plugin
Figma Theme Ui
Convert a Theme UI config to Figma Styles
Stars: ✭ 122 (-3.94%)
Mutual labels:  plugin
Rabbitmq Prometheus
A minimalistic Prometheus exporter of core RabbitMQ metrics
Stars: ✭ 124 (-2.36%)
Mutual labels:  plugin
Fastapi login
FastAPI-Login tries to provide similar functionality as Flask-Login does.
Stars: ✭ 123 (-3.15%)
Mutual labels:  plugin
Vite ruby
⚡️ Vite.js in Ruby, bringing joy to your JavaScript experience
Stars: ✭ 112 (-11.81%)
Mutual labels:  plugin
Vue Loaders
Vue + loaders.css
Stars: ✭ 127 (+0%)
Mutual labels:  plugin
Uppload
📁 JavaScript image uploader and editor, no backend required
Stars: ✭ 1,673 (+1217.32%)
Mutual labels:  plugin
Honkit
📖 HonKit is building beautiful books using Markdown - Fork of GitBook
Stars: ✭ 1,901 (+1396.85%)
Mutual labels:  plugin
Next Optimized Images
🌅 next-optimized-images automatically optimizes images used in next.js projects (jpeg, png, svg, webp and gif).
Stars: ✭ 1,870 (+1372.44%)
Mutual labels:  plugin
Gradle Maven Plugin
Gradle 5.x Maven Publish Plugin to deploy artifacts
Stars: ✭ 124 (-2.36%)
Mutual labels:  plugin
Sounds Webpack Plugin
🔊Notify or errors, warnings, etc with sounds
Stars: ✭ 125 (-1.57%)
Mutual labels:  plugin
Xcode Build Times
This BitBar/SwiftBar plugin shows the time you spend waiting for Xcode to do your builds
Stars: ✭ 122 (-3.94%)
Mutual labels:  plugin
Android Plugin Framework
Android插件框架,免安装运行插件APK ,支持独立插件和非独立插件
Stars: ✭ 1,630 (+1183.46%)
Mutual labels:  plugin
Mattermost Plugin Remind
a mattermost plugin that sets reminders for users and channels.
Stars: ✭ 121 (-4.72%)
Mutual labels:  plugin
Http Request Plugin
This plugin does a request to an url with some parameters.
Stars: ✭ 124 (-2.36%)
Mutual labels:  plugin
Webapp Webpack Plugin
[DEPRECATED] use favicons-webpack-plugin instead
Stars: ✭ 127 (+0%)
Mutual labels:  plugin
Dnspy.extension.holly
A dnSpy extension to aid reversing of obfuscated assemblies
Stars: ✭ 127 (+0%)
Mutual labels:  plugin
Glean
hotfix for go applications via plugin, supports Linux and MacOS
Stars: ✭ 125 (-1.57%)
Mutual labels:  plugin

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 <script>.

Usage

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

  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:

<template>
  <fb-signin-button
    :params="fbSignInParams"
    @success="onSignInSuccess"
    @error="onSignInError">
    Sign in with Facebook
  </fb-signin-button>
</template>

<script>
export default {
  data () {
    return {
      fbSignInParams: {
        scope: 'email,user_likes',
        return_scopes: true
      }
    }
  },
  methods: {
    onSignInSuccess (response) {
      FB.api('/me', dude => {
        console.log(`Good to see you, ${dude.name}.`)
      })
    },
    onSignInError (error) {
      console.log('OH NOES', error)
    }
  }
}
</script>

<style>
.fb-signin-button {
  /* This is where you control how the button looks. Be creative! */
  display: inline-block;
  padding: 4px 8px;
  border-radius: 3px;
  background-color: #4267b2;
  color: #fff;
}
</style>

That's it!

Looking for the Google counterpart?

License

MIT © Phan An

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].