cli-social-login
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

cli-social-login

Function to login the user and get an oauth access token from github, facebook, twitter, ... using firebase and a local server

It also emits the events cli_begin_login and cli_logeed_in so you can discover how many users try to login and then churn away.

Usage

npm i cli-social-login

Use inside your cli application to get an oauth provider token via the browser.

The function will pause until the user logins in the printed localhost url

Currently used in actions-cli to get the github token

import { loginOnLocalhost } from 'cli-social-login'
 
// starts a server on localhost to login the user
const { credentials, user } = await loginOnLocalhost({
    firebaseConfig,
    providers: ['github'],
    scopes: {
        github: ['repo'],
    },
    port: 3000, // default is a random available port
})
const githubToken = credentials.oauthAccessToken
// use your github token

Readme

Keywords

none

Package Sidebar

Install

npm i cli-social-login

Weekly Downloads

3

Version

1.0.5

License

ISC

Unpacked Size

7.71 MB

Total Files

12

Last publish

Collaborators

  • xmorse