Socket
Socket
Sign inDemoInstall

@jorge-salgado/facebook-api-graph-login

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @jorge-salgado/facebook-api-graph-login

Facebook API Graph Log In for JavaScript frameworks


Version published
Weekly downloads
1
Maintainers
1
Install size
3.51 kB
Created
Weekly downloads
 

Readme

Source

Facebook API Graph Log In

Facebook API Graph Log In and Log Out functions for popular JavaScript frameworks like:

  • Vue.js 2 and 3
  • React
  • Node.js

Getting started with Vue.js

  • Install the module:
npm i @jorge-salgado/facebook-api-graph-login
  • Add the module into your app:
<template>
  <button @click=" LogInWithFacebook">Log In</button>
  <button @click="LogOutFromFacebook">Log Out</button>
</template>
import  FACEBOOK_API_GRAPH_LOGIN from '@jorge-salgado/facebook-api-graph-login'
 
export default {
 mounted() {
   FACEBOOK_API_GRAPH_LOGIN('your app ID', 'version')
 },
   
 methods: {
     
   LogInWithFacebook() {
     window.FB.login(
       (response) => {

         if(response.authResponse){
           window.FB.api('/me', 
             {
               fields: 'id, first_name, last_name, email, gender, locale'
             },
             (response) => {

               let profile = {
                 id: response.id,
                 first_name: response.first_name,
                 last_name: response.last_name,
                 email: response.email,
                 gender: response.gender,
                 profile_picture: response.picture.data.url,                      
               }
                                   
               console.log(profile)

             }
           )
         }

       },
       { scope: 'email', }
     )
   },

   LogOutFromFacebook() {
     window.FB.api(
       '/me/permissions',
       'delete',
       null, 
       () => window.FB.logout(function(response) {
         console.log(response)
       }) 
     )
   }
         
 },
},
 

Keywords

FAQs

Last updated on 22 Nov 2021

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