Socket
Socket
Sign inDemoInstall

vue3-facebook-login

Package Overview
Dependencies
21
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vue3-facebook-login

A facebook login component which hides the complexity of facebook javascript SDK to initialize and connect with facebook and get access token.


Version published
Weekly downloads
18
increased by50%
Maintainers
1
Install size
8.64 kB
Created
Weekly downloads
 

Readme

Source

vue3-facebook-login

A facebook login component which hides the complexity of facebook javascript SDK to initialize and connect with facebook and get access token.

Installation

npm install vue3-facebook-login

Usage

vue3-facebook-login hides the complexity of facebook javascript SDK hence it is comparitively very easy to use.

ES6

For Local Registration

import FacebookLogin from "vue3-facebook-login";

export default {
    ...
    components : {
        FacebookLogin,
        ...
    },
    ...
}

For Global Registration

Update main.js

import { createApp } from "vue";
import App from "./App.vue";
...
import FacebookLogin from "vue3-facebook-login";

createApp(App).component("facebook-login", FacebookLogin)
...

After importing the component, you can use it in your templates as:

<facebook-login
    :appId="appId"
    @loggedIn="handleLogin"
    @loginFailed="handleLoginFailed"
>
</facebook-login>
...
</template>
<script>
...
{
    ...
    methods : {
        handleLogin(response) {
            console.log("User Successfully Logged In" , response)
        },
        handleLoginFailed() {
            console.log("User Cancelled or Abort the Login")
        }
    }
...
}
...

where appId is the appId recieved after creating App to use Facebook Authentication from Facebook

Props

PropertyRequiredTypeDefaultDecription
appIdtrueString-appId recieved from Facebook after creating App.
typefalseStringnormaldefines the type of button (minimal, normal, or custom)
themefalseStringlightdefines the theme for the button(light or dark)
textfalseStringLogin with Facebooktext for the login button when used custom type
classesfalseStringnullclasses needs to be applied to custom login button
stylesfalseStringnullstyles needs to be applied to custom login button

Events

EventInvoking TimeTypeDecription
loggedInWhen user successfully logged in with facebookfunctionpass a function which should contain all the operations to be performed after successful facebook login
loginFailedWhen user cancelled/abort login with facebookfunctionpass a function which should contain all the operations to be performed after cancel/abort facebook login

Warning

If after following all the instructions carefully Facebook Login is still not working and saying App not set up This app is still in development mode, and you don't have access to it. Switch to a registered test user or ask an app admin for permissions. then there may be 2 reasons behind it.

  1. You may have used wrong appId.
  2. Facebook Policy : The method FB.login can no longer be called from http pages

So I would Suggest just go ahead and move the app to a https environment and it will be finely working.

Creator

Mohammad Dilshad Alam created and maintains this component.

Keywords

FAQs

Last updated on 08 Nov 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc