Socket
Socket
Sign inDemoInstall

simple-social-signin

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-social-signin

Simple social signin


Version published
Maintainers
1
Created
Source

Build Status

Simple Social Signin

Simple social sign in for Node.js

Setup

npm install simple-social-signin

or

yarn add simple-social-signin

Usage

Google

  1. Import
import { getGoogleAuthUri, getGoogleUserInfo } from 'simple-social-signin';
  1. Get auth URI
const authUri = getGoogleAuthUri({
    clientId: 'a client ID',
    redirectUri: 'https://example.com/my-google-callback',
});  // Send this to the browser for the user to open
  1. Get user info
console.log(await getGoogleUserInfo({
    code: 'code URL query you get at /my-google-callback',
    clientId: 'a client ID',
    clientSecret: 'a client secret',
    redirectUri: 'https://example.com/my-google-callback'
}));
{
  email: '...',
  family_name: '...',
  gender: '...',
  given_name: '...',
  hd: '...',
  id: '...',
  link: '...',
  locale: '...',
  name: '...',
  picture: '...',
  verified_email: boolean,
  token: {
      access_token: '...',
      refresh_token: '...',
      scope: '...',
      token_type: '...',
      id_token: '...',
      expires_in: '...',
      created_at: '...',
  }
}

Facebook

  1. Import
import { getFacebookAuthUri, getFacebookUserInfo } from 'simple-social-signin';
  1. Get auth URI
const authUri = getFacebookAuthUri({
    clientId: 'a client ID',
    redirectUri: 'https://example.com/my-facebook-callback',
    state: 'a random string'
});
  1. Get user info
console.log(await getFacebookUserInfo({
    code: 'code URL query you get at /my-facebook-callback',
    clientId: 'a client ID',
    clientSecret: 'a client secret',
    redirectUri: 'https://example.com/my-facebook-callback'
}));
{
    email: '...',
    id: '...',
    first_name: '...',
    middle_name: '...',
    last_name: '...',
    short_name: '...',
    name: '...',
    name_format: '...',
    picture: {
        data: {
            height: 123,
            is_silhouette: boolean,
            url: '...',
            width: 321
        }
    }
}

Dependencies

  • Superagent HTTP lib

Development

Easiest way is to use yarn to install this package locally

In your app:

yarn add file:./../../simple-social-signin

FAQs

Package last updated on 25 Dec 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc