All Projects → Jebasuthan → Vue-Facebook-Google-oAuth

Jebasuthan / Vue-Facebook-Google-oAuth

Licence: other
SignIn or Signup with Facebook and Google using Vue without any external packages

Programming Languages

javascript
184084 projects - #8 most used programming language
Vue
7211 projects
CSS
56736 projects
HTML
75241 projects
shell
77523 projects

Projects that are alternatives of or similar to Vue-Facebook-Google-oAuth

angular5-social-login
Social authentication module for Angular 5. Includes Facebook and Google login with AOT compatibility.
Stars: ✭ 40 (-41.18%)
Mutual labels:  facebook-login, social-login
Simpleauth
A easy to use social authentication android library. (Facebook, Google, Twitter, Instagram)
Stars: ✭ 216 (+217.65%)
Mutual labels:  facebook-login, social-login
social-auth-kivy
Integrate Google, Facebook, Github & Twitter login in kivy applications
Stars: ✭ 133 (+95.59%)
Mutual labels:  facebook-login, social-login
spring-boot-jwt-social-auth
Implementing JWT authentication and integrate Facebook login with it using Spring Boot
Stars: ✭ 32 (-52.94%)
Mutual labels:  facebook-login, social-login
Spring Boot React Oauth2 Social Login Demo
Spring Boot React OAuth2 Social Login with Google, Facebook, and Github
Stars: ✭ 676 (+894.12%)
Mutual labels:  facebook-login, social-login
Socialloginmanager
DEPRECATED
Stars: ✭ 178 (+161.76%)
Mutual labels:  facebook-login, social-login
LeonSocialLogin
Leon Social Login is an Android library written to Integrate (Twitter, Facebook, Google, SnapChat) login.
Stars: ✭ 16 (-76.47%)
Mutual labels:  facebook-login, social-login
KASocialLogins
This is Social login library in which you can login through Facebook , LinkedIn and Google
Stars: ✭ 15 (-77.94%)
Mutual labels:  facebook-login, social-login
Angularx Social Login
Social login and authentication module for Angular 9
Stars: ✭ 442 (+550%)
Mutual labels:  facebook-login, social-login
Argus Android
Login/Registration Module for Android
Stars: ✭ 89 (+30.88%)
Mutual labels:  facebook-login, social-login
Magento 2 Social Login
Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps
Stars: ✭ 156 (+129.41%)
Mutual labels:  facebook-login, social-login
React Native Starter Kit
React Native Starter Kit with Firebase Auth and Facebook Login
Stars: ✭ 251 (+269.12%)
Mutual labels:  facebook-login
Pwa Auth
Web component that lets your users sign-in/sign-up using their Microsoft, Google, Facebook, or Apple account. Your app receives their email address, name, and profile picture.
Stars: ✭ 139 (+104.41%)
Mutual labels:  facebook-login
Base App
An app to help jumpstart a new Rails 4 app. Features Ruby 2.0, PostgreSQL, jQuery, RSpec, Cucumber, user and admin system built with Devise, Facebook login.
Stars: ✭ 127 (+86.76%)
Mutual labels:  facebook-login
React Most Wanted
React starter kit with "Most Wanted" application features
Stars: ✭ 1,867 (+2645.59%)
Mutual labels:  facebook-login
SATOSA
Proxy translating between different authentication protocols (SAML2, OpenID Connect and OAuth2)
Stars: ✭ 139 (+104.41%)
Mutual labels:  social-login
Facebooktoolkit
a tool to get Facebook data, and some Facebook bots, and extra tools found on Facebook Toolkit ++.
Stars: ✭ 227 (+233.82%)
Mutual labels:  facebook-login
Login Screen Swift
iOS Login Screen written in Swift 5
Stars: ✭ 114 (+67.65%)
Mutual labels:  facebook-login
Mern Boilerplate
Fullstack boilerplate with React, Redux, Express, Mongoose, Passport Local, JWT, Facebook and Google OAuth out of the box.
Stars: ✭ 112 (+64.71%)
Mutual labels:  facebook-login
parse-oauth2-sns
Parse-server module for implementing an OAuth2 Social Media Login with Express in Node.js
Stars: ✭ 21 (-69.12%)
Mutual labels:  social-login

Signup with Facebook / Google using Vue

Handling SignUp or SignIn with Google and Facebook using Pure VueJS applications without any external package.

Project setup

npm install

Google Setup Client ID

import GoogleAuth from '@/config/google.js'
const gauthOption = {
clientId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com',
    scope: 'profile email',
    prompt: 'select_account'
}
Vue.use(GoogleAuth, gauthOption)

Options

Property Type Required Description
clientId String Required. The app's client ID, found and created in the Google Developers Console.
scope String Optional. Default value is profile email. Full list of scopes.
prompt String Optional. This value using for authCode. The possible values are select_account or consent. Default value is select_account. To get refresh token from auth code, use consent.
fetch_basic_profile Boolean Optional. If set to true, email profile openid will be automatically added as scope. Default value is true.

Methods

Property Description Type
GoogleAuth return of gapi.auth2.getAuthInstance() Object
isAuthorized Whether or not you have auth Boolean
isInit Whether or not api init Boolean
isLoaded Whether or not api init. will be deprecated. Function
signIn function for sign-in Function
getAuthCode function for getting authCode Function
signOut function for sign-out Function

Usage

We already initalized GoogleAuth and directly we can add click event for the login button as below,

loginWithGoogle () {
  this.$gAuth
  .signIn()
  .then(GoogleUser => {
    // on success do something
    console.log('GoogleUser', GoogleUser)
    console.log('getId', GoogleUser.getId())
    console.log('getBasicProfile', GoogleUser.getBasicProfile())
    console.log('getAuthResponse', GoogleUser.getAuthResponse())
  })
  .catch(error => {
    console.log('error', error)
  })
}

Facebook App ID Setup

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

export const initFbsdk = () => {
    return new Promise(resolve => {
        window.fbAsyncInit = function() {
            FB.init({
                appId      : 'xxxxxxxxxxxxxxxxxxx',
                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'));
    })
}

If you're not in a modular environment, just include it as a <script>.

<script type="text/javascript" src="https://connect.facebook.net/en_US/sdk.js"></script>

Usage

Step 1: import and use the plugin if you're in a modular environment otherwise plugin will register itself.

import { initFbsdk } from '@/config/facebook_oAuth.js'

Step 2: Initialize the Facebook instance with the app id

mounted () {
   initFbsdk()
}

Step 3: Add the button click event

loginWithFacebook () {
  window.FB.login(response => {
    console.log('fb response', response)
  }, this.params)
}

Compiles and hot-reloads for development

npm run serve

Demo Link

Login Screen

Login

SignUp Screen

SignUp

Facebook with SignUp/SignIn

Facebook SignUp/SignIn

Google with SignUp/SignIn

Google SignUp/SignIn

Compiles and minifies for production

npm run build

Run your tests

npm run test

Lints and fixes files

npm run lint

Run your unit tests

npm run test:unit

Customize configuration

See Configuration Reference.

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