All Projects → adi518 → Vue Facebook Login

adi518 / Vue Facebook Login

Licence: mit
💅 A renderless Vue.js component for composing Facebook Login

Projects that are alternatives of or similar to Vue Facebook Login

Oauth
🔗 OAuth 2.0 implementation for various providers in one place.
Stars: ✭ 336 (+112.66%)
Mutual labels:  login, facebook
React Native Swipeable Cards Demo
Facebook-style swipeable cards with React Native Interactable.
Stars: ✭ 36 (-77.22%)
Mutual labels:  facebook, component
Play Pac4j
Security library for Play framework 2 in Java and Scala: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 375 (+137.34%)
Mutual labels:  login, facebook
OAuthLogin.AspNetCore
第三方平台联合登陆(facebook、微信、微博、QQ、Kakao)
Stars: ✭ 43 (-72.78%)
Mutual labels:  facebook, login
Spark Pac4j
Security library for Sparkjava: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 154 (-2.53%)
Mutual labels:  login, facebook
node-facebook-twitter-google-github-login
Node, Express, Mongoose, Passport, Facebook, Twitter, Google and Github Authentication (Login)
Stars: ✭ 31 (-80.38%)
Mutual labels:  facebook, login
Simplicity
A simple way to implement Facebook and Google login in your iOS apps.
Stars: ✭ 683 (+332.28%)
Mutual labels:  login, facebook
Turnstile
An authentication framework for Swift.
Stars: ✭ 163 (+3.16%)
Mutual labels:  login, facebook
Android
Android projects with reusable components which will be useful in your applications.
Stars: ✭ 81 (-48.73%)
Mutual labels:  login, facebook
Nemiro.oauth.dll
Nemiro.OAuth is a class library for authorization via OAuth protocol in .NET Framework
Stars: ✭ 45 (-71.52%)
Mutual labels:  login, facebook
OAuthLogin
第三方平台联合登陆(facebook、微信、微博、QQ、Kakao)
Stars: ✭ 57 (-63.92%)
Mutual labels:  facebook, login
Facebookclientplugin
Facebook Client Plugin for Xamarin iOS and Android
Stars: ✭ 89 (-43.67%)
Mutual labels:  login, facebook
Spring Security Pac4j
pac4j security library for Spring Security: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 231 (+46.2%)
Mutual labels:  login, facebook
b11
11 DIGIT FACEBOOK ACCOUNTS PASSWORD CRACKER <br> FOR BANGLADESHI TERMUX USERS
Stars: ✭ 87 (-44.94%)
Mutual labels:  facebook, login
Login With
Stateless login-with microservice for OAuth
Stars: ✭ 2,301 (+1356.33%)
Mutual labels:  login, facebook
Buji Pac4j
pac4j security library for Shiro: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 444 (+181.01%)
Mutual labels:  login, facebook
React Messenger Customer Chat
React component for messenger customer chat plugin
Stars: ✭ 221 (+39.87%)
Mutual labels:  facebook, component
Socialite
Socialite is an OAuth2 Authentication tool. It is inspired by laravel/socialite, you can easily use it without Laravel.
Stars: ✭ 1,026 (+549.37%)
Mutual labels:  login, facebook
Social Login Helper Deprecated
A simple android library to easily implement social login into your android project
Stars: ✭ 81 (-48.73%)
Mutual labels:  login, facebook
Spring Webmvc Pac4j
Security library for Spring Web MVC: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 110 (-30.38%)
Mutual labels:  login, facebook

Vue Facebook Login

A renderless Vue.js component for composing Facebook login.

Install

NPM

npm install vue-facebook-login-component

Yarn

yarn add vue-facebook-login-component

Embed Directly

<script src="https://cdn.jsdelivr.net/npm/vue-facebook-login-component/dist/vueFacebookLoginComponent.umd.min.js"></script>

When embedding, the script automatically registers itself as a Vue plugin.

Usage

To use the component in your template, simply import and register with your component.

Template and Script

<template>
  <v-facebook-login app-id="966242223397117"></v-facebook-login>
</template>

<script>
  import VFacebookLogin from 'vue-facebook-login-component'

  export default {
    components: {
      VFacebookLogin,
    },
  }
</script>

Features

  • Zero dependencies (gzipped: 9.98 KiB)
  • Handpicked Facebook SVG logos
  • Customizable through props and scoped-slots
  • Scope component (renderless/render-props pattern)
  • Button component with flex-box CSS and rem sizing

JS Fiddle

See JS Fiddle for a vanilla example.

Props

Name Type Default Note
value Object {} Used for one-way V-Model. [ * ]
app-id String NONE Required. [ * ]
version String 'v6.0' See versions. [ * ]
options Object { cookie: true, xfbml: true, autoLogAppEvents: true } See options. [ * ]
login-options Object { scope: 'email' } See options. [ * ]
logo-class String NONE
logo-style Object {}
text-class String NONE
text-style Object {}
loader-class String NONE
loader-style Object {}
transition Array [] Array of CSS transition values. Example:

[ 'background-color 0.15s ease-in-out', 'padding 0.15s ease-in-out', ... ].
use-alt-logo Boolean false Use Iconmonstr alternate Facebook logo.
async-delay Number 0 Minimum delay for asynchronous operations. [ * ]
sdk-locale String 'en_US' See localization. [ * ]

[ * ] - Scope component prop.

useAltLogo Prop

Offering an alternative logo from Iconmonstr (this will bring back v1.x logo). This prop was released as useAlternateLogo in 2.0.0 but shortened to useAltLogo in 2.1.0, a one-off breaking change.

Slots

Name Default Description
login 'Continue with Facebook'
logout 'Logout'
working 'Please wait...'
logo Iconmonstr Facebook 6 See Iconmonstr for more options.
before NONE Before all nested elements.
after NONE After all nested elements.
error '⛔ Error' Shown on error (e.g., SDK load failure).

Events

Name Payload Description Note
sdk-init (sdk[Object]) Returns an object with
Facebook SDK instance and scope object.
[ * ]
login (response[Object]) User logged in. [ * ]
logout (response[Object]) User logged out. [ * ]
click [Void]   [ * ]

[ * ] - Scope component event.

Sdk-Init Event

You can use this event to grab the Facebook SDK instance, but also the underlying component scope object. Using this object, you can control the component empirically, similarly to how you would with ref.

⚠️ The scope reference is not reactive and you cannot relay on it for other than utilizing the scope methods. For reactivity, use the v-model directive.

Sdk-Init Event Example

<template>
  <div>
    <v-facebook-login v-model="model" @sdk-init="handleSdkInit" />
    <button v-if="scope.logout && model.connected" @click="scope.logout">
      Logout
    </button>
  </div>
</template>

<script>
  export default {
    data: () => ({
      FB: {},
      model: {},
      scope: {},
    }),
    methods: {
      handleSdkInit({ FB, scope }) {
        this.FB = FB
        this.scope = scope
      },
    },
  }
</script>

Scope Component (Advanced Customization)

If props, slots and events do not provide enough customization, you can use an underlying component called v-fb-login-scope. This component uses the render prop (known as "scoped-slot" in Vue) approach for composition. This means, it does not render any HTML or CSS, but rather expose a scoped-slot with attributes and methods that are committed as API. Read more about scoped slots.

Props and Events

Refer to the tables above for scope component specific props/events.

Scoped-Slot Scope (Attributes and Methods)

Name Type Description
login Function Call SDK login method.
logout Function Call SDK logout method.
toggleLogin Function Toggle SDK login/logout methods.
working Boolean Asynchronous operation is taking place.
idle Boolean No asynchronous operation is taking place.
connected Boolean User is logged in.
disconnected Boolean User is logged out.
enabled Boolean Button is enabled.
disabled Boolean Button is disabled.

Scope Component Example

The following snippet is a minimal usage example, see source for a real-world example.

<template>
  <v-facebook-login-scope>
    <!-- Compose HTML/CSS here, otherwise nothing will be rendered -->
    <button slot-scope="scope">
      <!-- Compose with `scope` here -->
    </button>
  </v-facebook-login-scope>
</template>

<script>
  import { VFBLoginScope as VFacebookLoginScope } from 'vue-facebook-login-component'

  export default {
    components: {
      VFacebookLoginScope,
    },
  }
</script>

Loading Facebook SDK

This component embeds the Facebook SDK snippet unless it find an existing SDK instance. However, be sure to resolve window.fbAsyncInit before a component instance is created, otherwise a racing condition will occur and it may not be able to find the SDK instance. See Facebook docs for more.

Nuxt Support

This component renders on the client-side only. To do that, you have to complete a few steps.

  1. Generate a self-signed certificate.
  2. Configure nuxt.config.js for HTTPS.
  3. Import the component for client-side only:
<template>
  <client-only>
    <v-facebook-login app-id="966242223397117"></v-facebook-login>
  </client-only>
</template>

<script>
  export default {
    components: {
      VFacebookLogin: () =>
        process.client ? import('vue-facebook-login-component') : null,
    },
  }
</script>

Legacy Browser Support

Version 3.x

🧡 Mind breaking changes from 3.x to 2.x.

Version 3.x does NOT include polyfills (core-js) as 2.x, in fact it was an error to include them at all. If you require new language API support for legacy browsers, you might have to add it to your app or setup your build target correctly, which will auto apply the necessary polyfills. See Vue CLI docs: https://cli.vuejs.org/guide/browser-compatibility.html#polyfills

Version 2.x

❤️ You probably don't need to apply transformations or polyfills to support IE.

The current build statistically targets legacy browsers like IE 11 and applies transforms and polyfills adaptively. However, it is bound to change in the future as statistics change. In such case, you'll need to add @babel/polyfill to your dependencies (notice the deprecated way to do it and the newly recommended one). Additionally, you'll have to add this component to your transpiled dependencies (e.g., using transpileDependencies option in vue.config.js).

⚠️ Notice the difference between a transform and a polyfill. Future syntax has to be transformed, while new language API requires a polyfill.

Version 1.x

💚 TL;DR: Upgrade to 2.x to support legacy browsers.

Versions <=1.3.6 should work in legacy browsers without issues. Versions 1.3.7-1.5.0 require @babel/polyfill if your app doesn't already include it. Versions 1.5.1 to 1.6.0 have a maltransformed and unpolyfilled build that will not work with legacy browsers unless you add it to your transpiled dependencies and import @babel/polyfill. To fix that please upgrade to 2.x (recommended) or downgrade to <= 1.5.0.

Development

Fork, clone and use the following scripts.

Component

yarn start

Documentation

yarn start:docs

Tests

yarn test

Support

Please search existing issues (including closed ones) before starting a new issue. 🙌

Contributing

Start a pull request, run tests and update as necessary before submitting.

Attributions

Related Links

License

Copyright (c) 2020 by MIT

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