# lite-login

> login through google

Latest version **0.0.1** (published 2021-02-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install lite-login
pnpm add lite-login
yarn add lite-login
bun add lite-login
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2021-02-18 |
| First published | 2021-02-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | talmobi |
| Maintainers | talmobi |
| Keywords | lite-login |

## Links

- npm: https://www.npmjs.com/package/lite-login
- Repository: https://github.com/talmobi/lite-login
- Homepage: https://github.com/talmobi/lite-login#readme
- Issues: https://github.com/talmobi/lite-login/issues
- npm.io page: https://npm.io/package/lite-login

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 0.0.1 (latest) — 2021-02-18

## README

[![npm](https://img.shields.io/npm/v/lite-login.svg?maxAge=3600)](https://www.npmjs.com/package/lite-login)
[![npm](https://img.shields.io/npm/dm/lite-login.svg?maxAge=3600)](https://www.npmjs.com/package/lite-login)
[![npm](https://img.shields.io/npm/l/lite-login.svg?maxAge=3600)](https://www.npmjs.com/package/lite-login)

# lite-login
Login through google.

## Demo

[https://lite-login.jin.fi](https://lite-login.jin.fi)

## Easy to use

```javascript
const express = require('express')
const app = express()
const port = 3000

// https://console.cloud.google.com/home/dashboard
// - create/select project
// - APIs & Services -> Credentials -> Client ID -> Authorised redirect URIs
// - APIs & Services -> OAuth consent screen -> required + email address scope
const opts = require('./.google-auth.json') // { "client_id": "1003**...**nt.com", "client_secret": "B7**...**ve" }
opts.redirect_uri = 'http://localhost:3000/auth/google'

const ll = require('lite-login')
const login = ll.google(opts) // opts = { redirect_uri, client_id, client_secret }

app.get('/', (req, res) => {
  res.send(
    `<a href="${ login.url }">Login Through Google</a>`
  )
})

app.get('/auth/google', async function (req, res) {
  const code = req.query.code
  const user = await login.getUser(code)
  res.send(
    `<pre>${ user }</pre>`
  )
})

app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`)
}
```

## About

Simple login through google. Get user email.

## Why

Easy to use for minimalistic use-case.

## For who?

## Roadmap

- [x] Google
- [ ] Facebook
- [ ] Twitter

## How

Calling appropriate google REST endpoints with node's builtin https client.

ref: https://tomanagle.medium.com/google-oauth-with-node-js-4bff90180fe6

## Similar
[package/google-auth-library](https://www.npmjs.com/package/google-auth-library)

[tomanagle/google-oauth-tutorial](https://github.com/tomanagle/google-oauth-tutorial)

## Test
```
Manual tests.
```

---
_Source: https://npm.io/package/lite-login · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
