vue-facebook-signin-button-directive

1.0.2 • Public • Published

vue-facebook-signin-button-directive

🔐 A simple Vue directive to include Facebook Sign-In Button behavior in any component.

Screenshot

Install

$ npm install --save vue-facebook-signin-button-directive

$ yarn add vue-facebook-signin-button-directive

Usage

Import the directive and attach it to any component, let's give you an example:

Important: OnFacebookAuthSuccess and OnFacebookAuthFail are mandatory methods you have to declare in your component where you are using the directive.

<template>
  <button v-facebook-signin-button="appId" class="facebook-signin-button"> Continue with Facebook</button>
</template>

<script>
import FacebookSignInButton from 'vue-facebook-signin-button-directive'
export default {
  directives: {
    FacebookSignInButton
  },
  data: () => ({
    appId: 'Your_Facebook_App-Id'
  }),
  methods: {
    OnFacebookAuthSuccess (idToken) {
      // Receive the idToken and make your magic with the backend
    },
    OnFacebookAuthFail (error) {
      console.log(error)
    }
  }
}
</script>

<style>
.facebook-signin-button {
  color: white;
  background-color: #3b5998;
  height: 50px;
  font-size: 16px;
  border-radius: 10px;
  padding: 10px 20px 25px 20px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
</style>

That's all.

Live example.

Looking for the Google counterpart?

License

MIT © Manuel Mejia Jr.

Readme

Keywords

Package Sidebar

Install

npm i vue-facebook-signin-button-directive

Weekly Downloads

29

Version

1.0.2

License

ISC

Unpacked Size

49.6 kB

Total Files

5

Last publish

Collaborators

  • mejiamanuel57