# @joelethan/linkedin-oauth2

> npm package for authenticating with Linkedin using OAuth2 access tokens

Latest version **0.0.5** (published 2020-06-23) · ISC license · 0 weekly downloads

## Install

```sh
npm install @joelethan/linkedin-oauth2
pnpm add @joelethan/linkedin-oauth2
yarn add @joelethan/linkedin-oauth2
bun add @joelethan/linkedin-oauth2
```

## 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.5 |
| Published | 2020-06-23 |
| First published | 2020-05-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Joel Katusiime |
| Maintainers | joelethan |
| Keywords | authentication, linkedin, token, oauth2 |

## Links

- npm: https://www.npmjs.com/package/@joelethan/linkedin-oauth2
- Repository: https://github.com/joelethan/linkedin-oauth2
- Homepage: https://github.com/joelethan/linkedin-oauth2#readme
- Issues: https://github.com/joelethan/linkedin-oauth2/issues
- npm.io page: https://npm.io/package/@joelethan/linkedin-oauth2

## Dependencies (2)

- [dotenv](https://npm.io/package/dotenv.md) ^8.2.0
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.0

## Alternatives

- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads
- [escher-request](https://npm.io/package/escher-request.md) — 545 weekly downloads

## Recent versions

- 0.0.5 (latest) — 2020-06-23
- 1.0.5 — 2020-06-23
- 1.0.4 — 2020-05-18
- 1.0.3 — 2020-05-18
- 1.0.2 — 2020-05-18
- 1.0.1 — 2020-05-18
- 1.0.0 — 2020-05-18

## README

# linkedin-oauth2
A simple and well documented LinkedIn OAuth2 package.

## Install

  ~~~
  npm i @joelethan/linkedin-oauth2
  ~~~

## Usage
### Code
~~~javascript
import { linkedInMiddleware, callbackMiddleware } from "@joelethan/linkedin-oauth2";

app.get('/redirecturl', redirectMiddleware)

app.get('/linkedin', linkedInMiddleware, (req, res) =>{
    const profile = req.query.profile;
    User.findOrCreate({email: profile.email}, (error, user)=> {
        // do something with user
    });
~~~

### Variables
~~~
linkedinRedirectUrl
LINKEDIN_KEY
LINKEDIN_SECRET
~~~

The above three variables must be set for authentication to work. The linkedinRedirectUrl is setup as shown in the snipet below while the other two variables correspond to the Client_ID and Client_Secret from the app created at [Linkedin developers](https://www.linkedin.com/developers/)

Requested for authorization code.

~~~
GET https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=LINKEDIN_KEY&redirect_uri=linkedinRedirectUrl&state=DCEeFWf45A53sdfKef424&scope=r_liteprofile%20r_emailaddress%20w_member_social
~~~

Once redirected to the Linkedin login page, Enter credentials to recieve an `access_token`.

Copy the `access_token` and pass it as a query parameter as below

~~~
http://localhost:8080/linkedin?access_token=AQXZ84hgiJjlB2ka61WrVbNTB74tUKv3gHZ
~~~

For more clarity on the LinkedIn API Configuration, read [this](https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/consumer/context)

## Issue Reporting

If you have found a bug or bump into difficulty, please report them at this repository [issues](https://github.com/joelethan/linkedin-oauth2/issues) section.

## Author

[Joel Katusiime](https://github.com/joelethan)

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