Socket
Socket
Sign inDemoInstall

social-login-oauth

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    social-login-oauth

Social login and authentication which supports authentication with **Google** and **Facebook** platforms.


Version published
Weekly downloads
402
increased by46.72%
Maintainers
1
Install size
56.4 kB
Created
Weekly downloads
 

Readme

Source

Social Login for all Typescript Projects like Angular 2 & above, reactJS, VueJS etc ..,

Social login and authentication which supports authentication with Google and Facebook platforms.

Getting started

Install via npm

npm install social-login-oauth --save 

Usage


import { GoogleService, FacebookService } from "social-login-oauth";

@Component({
  selector: 'app-demo',
  templateUrl: './demo.component.html',
  styleUrls: ['./demo.component.css']
})
export class DemoComponent {

  constructor() { }

  googleSignIn() {
    GoogleService.signIn(gClientid)
  }
  
  getGoogleLoginStatus(){
    GoogleService.getLoginStatus() 
  }

  facebookSignIn(): void {
    FacebookService.signIn(facebookID)
  } 
  
  getFacebookLoginStatus(){
    FacebookService.getLoginStatus()
  }

  googleSignOut(): void {
    //if revoke is true, it will be disconnected instead of signout.
    GoogleService.signOut(revoke);
  }
  
  facebookSignOut(): void {
    FacebookService.signOut();
  }

}

Possible fields get after the Social login.

    id: string;
    email: string;
    name: string;
    photoUrl: string;
    firstName: string;
    lastName: string;
    authToken: string;
    idToken?: string;
    authorizationCode?: string;
    provider?: string;
    facebook?: any;
    linkedIn?: any;

Specifying custom scope

For Google


const googleLoginOptions: LoginOpt = {
  scope: 'profile email'
}; // https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2clientconfig

GoogleService.signIn(gClientid,googleLoginOptions)

For Facebook


const fbLoginOptions: LoginOpt = {
  scope: 'pages_messaging,pages_messaging_subscriptions,email,pages_show_list,manage_pages',
  return_scopes: true,
  enable_profile_selector: true
}; // https://developers.facebook.com/docs/reference/javascript/FB.login/v2.11

FacebookService.signIn(facebookID,fbLoginOptions)

License

MIT

Keywords

FAQs

Last updated on 03 Dec 2019

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