@node-plex/api-auth
Authorizes external applications to use the Plex API.
Releases
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
Contributing
Please read CONTRIBUTING.md for details on how to contribute to this project.
License
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.