1.1.2 • Published 6 years ago

@and-end/linkedin-auth-client v1.1.2

Weekly downloads
-
License
CC BY-NC 4.0
Repository
github
Last release
6 years ago

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