Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phillipj/node-plex-api-credentials
Credentials authentication for plex-api
https://github.com/phillipj/node-plex-api-credentials
Last synced: 18 days ago
JSON representation
Credentials authentication for plex-api
- Host: GitHub
- URL: https://github.com/phillipj/node-plex-api-credentials
- Owner: phillipj
- License: mit
- Created: 2015-07-22T20:19:12.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T22:41:22.000Z (almost 2 years ago)
- Last Synced: 2024-10-14T12:08:37.890Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 726 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# plex-api-credentials [![Build Status](https://api.travis-ci.org/phillipj/node-plex-api-credentials.png)](http://travis-ci.org/phillipj/node-plex-api-credentials)
[plex-api](https://www.npmjs.com/package/plex-api) authenticator module which provides PlexHome credentials authentication.
*It's usually not required to install and handle this package explicitly, as username/password/managed user credentials
can be specified when creating an plex-api client.*## Usage
```bash
$ npm install plex-api-credentials --save
```Then provide the plex-api-credentials object to the plex-api client upon creation:
```js
const PlexAPI = require('plex-api');
const credentials = require('plex-api-credentials');const userAndPass = credentials({
username: 'MainParentUser',
password: 'aSecretPassword',
managedUser: { // Required for Plex managed users
name: 'RestrictedFamilyMember',
pin: '1234' // Optional four digit pin code if user is protected
}
});const client = new PlexAPI({
hostname: '192.168.0.1',
authenticator: userAndPass
});// use PlexAPI client as usual
client.find('/library/sections', ...);
```## Events
### `token`
Emitted whenever a token has been retrieved from plex.tv.
### Usage
```js
userAndPass.on('token', function(token){
// possibly cache retrieved token here?
});
```## Contributing
Contributions are more than welcome! Create an issue describing what you want to do.
If that feature is seen to fit this project, send a pull request with the changes accompanied by tests.### Running tests
```bash
$ npm install
$ npm test
```To run all tests as soon as files or tests has been changed:
```bash
$ npm run test:watch
```## License
(The MIT License)Copyright (c) 2015-2016 Phillip Johnsen <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.