@node-plex/api-auth

1.0.0-rc.3 • Public • Published

@node-plex/api-auth

Authorizes external applications to use the Plex API.

CI pipeline status project vulnerabilities project dependencies code coverage code style standardjs versioning strategy required Node version

Releases

latest release version next release version package install size

Getting Started

Installation

$ npm install @node-plex/api-auth

Usage

const PlexAppAuthenticator = require('@node-plex/api-auth')

const paa = new PlexAppAuthenticator({
  headers: {
    'X-Plex-Client-Identifier': '<your application uuidv4>',
    'X-Plex-Product': '<your application name>',
    'X-Plex-Version': '<your application version>',
  },
  password: '<your Plex password>',
  username: '<your Plex username>',
})

paa.authorize()
  .then(console.log) // resolves to auth token as String
  .catch(console.error)

ℹ️ headers key may contain:

// an object with header name:value pairs
{ 'X-Header': 'value' }
// a Header instance
const headers = new Headers()
headers.set('X-Header', 'value')

ℹ️ headers must include:

"X-Plex-Client-Identifier",
"X-Plex-Product",
"X-Plex-Version"

Built with

Fedora Linux VSCode GitLab Caffeine

Contributing

Please read CONTRIBUTING.md for details on how to contribute to this project.

License

NPM

Copyright 2020 © Chet Manley.

Acknowledgements

Based on phillipj's node-plex-api-credentials, this rewrite aims to improve upon it in two major ways:

  • Implement the most current official token retrieval method provided by Plex.
  • Use ES2015+ code conventions and best practices.

/@node-plex/api-auth/

    Package Sidebar

    Install

    npm i @node-plex/api-auth

    Weekly Downloads

    2

    Version

    1.0.0-rc.3

    License

    MIT

    Unpacked Size

    14.6 kB

    Total Files

    12

    Last publish

    Collaborators

    • chet.manley