# express-oauth-any

> OAuth login for any login provider that just works out of the box - for nodejs/expressjs

Latest version **1.0.6** (published 2021-06-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install express-oauth-any
pnpm add express-oauth-any
yarn add express-oauth-any
bun add express-oauth-any
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2021-06-19 |
| First published | 2021-04-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 8 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | madhavanmalolan |

## Links

- npm: https://www.npmjs.com/package/express-oauth-any
- Repository: https://github.com/madhavanmalolan/express-oauth-any
- Homepage: https://github.com/madhavanmalolan/express-oauth-any#readme
- Issues: https://github.com/madhavanmalolan/express-oauth-any/issues
- npm.io page: https://npm.io/package/express-oauth-any

## Dependencies (5)

- [axios](https://npm.io/package/axios.md) ^0.21.1
- [googleapis](https://npm.io/package/googleapis.md) ^72.0.0
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.1
- [express-session](https://npm.io/package/express-session.md) ^1.17.1
- [login-with-twitter](https://npm.io/package/login-with-twitter.md) ^1.2.4

## Recent versions

- 1.0.6 (latest) — 2021-06-19
- 1.0.4 — 2021-05-05
- 1.0.3 — 2021-04-24
- 1.0.2 — 2021-04-24
- 1.0.1 — 2021-04-18

## README

# Express OAuth Any
OAuth implementations for most popular OAuth providers 

# Supported OAuth Providers
Implemented : 
- Twitter
- Google
- GitHub

Coming soon (Help requested) :
- Facebook
- Microsoft
- Apple
- Amazon
- LinkedIn

## Installation
### Dependencies
express and express-session
### Install
`$ npm install express-oauth-any`

Add the following to app.js

```
  var { registerOauth } = require('express-oauth-any');
  app.use(session({ secret: "yoursecret"}))
  registerOauth(app, options);
```

### Options
Options should include the platforms for which you need oauth enabled
```
  options = {
      twitter: {
          key: "YOUR CONSUMER KEY", 
          secret: "YOUR CONSUMER SECRET"
      }
  }
```

## Usage
Once installed, call the following url to invoke the login process 
```<a href="/oauth-any/twitter/login?state=/profile"> Login with Twitter </a>```

Once the login is successful, user will be redirected to the url determined by `state` and login information will be available in `req.session[PLATFORM]`, e.g. `req.session.twitter` 

You can replace "twitter" with "google" in the above example for login using Google

### Twitter
```
  options = {
      twitter: {
          key: "YOUR CONSUMER KEY", 
          secret: "YOUR CONSUMER SECRET"
      }
  }
```

Get your Consumer Key and Consumer Secret on [developers.twitter.com](developers.twitter.com)
```
http://localhost:<PORT>/oauth-any/twitter/callback
https://yourdomainname.com/oauth-any/twitter/callback
```

### Google
```
  options = {
      google: {
          key: "Your Client Id", 
          secret: "Your Client Secret"
      }
  }
```
Get your Consumer Key and Consumer Secret on [https://console.cloud.google.com/apis/credential](https://console.cloud.google.com/apis/credential)

Create an OAuth Client ID
Set callback urls as
```
http://localhost:<PORT>/oauth-any/google/callback
https://yourdomainname.com/oauth-any/google/callback
```

### GitHub
```
    options = {
      github: {
        key: "Your Client ID"
        secret: "Your Client Secret"
        scope: "Your Selected Scope"
      }
    }
```


## Requested help
Please help me implement the various [OAuth Providers listed here](https://en.wikipedia.org/wiki/List_of_OAuth_providers) so that others don't have to

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