@and-end/linkedin-auth-client
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published


LinkedIn Logo

LinkedIn auth client

A simple client for authentication using LinkedIn.

npm latest version npm weekly downloads Maintainability code style: prettier License: CC BY-NC 4.0

Installation  ●  Usage  ●  Contributing  ●  Versioning  ●  Authors  ●  License

Installation

$ npm install @and-end/linkedin-auth-client

Usage

import fetch from 'node-fetch';
import LinkedInAuthClient from '@and-end/linkedin-auth-client';

const config = { fetchProvider: fetch };
const params = {
  client_id: 'xxxxxxxxxxxxxx',
  client_secret: 'xxxxxxxxxxxxxxxx',
  redirect_uri: 'https://example.com/auth/linkedin',
  scope: ['r_liteprofile', 'r_emailaddress'],
  response_type: 'code',
  grant_type: 'authorization_code'
};

const linkedInAuthClient = new LinkedInAuthClient(config);

linkedInAuthClient.init(params);

const authorizationCode = 'xxxxxxxxxxxxxxxxxxxx';
const data = await linkedInAuthClient.getAccessToken(authorizationCode);

console.log(data); // => { access_token: 'xxxxxxx', expires_in: '5184000' }

See how to request an authorization code in test/devServer.ts

Api reference: https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/consumer/context#step-2-request-an-authorization-code

Contributing

Please read CONTRIBUTING.md for details on the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Kacper Ochmański - Initial work, development - ochmanski

See also the list of contributors who participated in this project.

License

This project is licensed under the CC BY-NC 4.0 License - see the LICENSE file for details

Package Sidebar

Install

npm i @and-end/linkedin-auth-client

Weekly Downloads

3

Version

1.1.2

License

CC BY-NC 4.0

Unpacked Size

49 kB

Total Files

8

Last publish

Collaborators

  • ochmanski