node-plex-api-pinauth
An authentication module for node-plex-api that handles the API requests necessary for getting an auth token using a PIN.
Current State
It's usable, but it's ugly. One of the public methods returns a promise while the other uses a callback. That's dumb. There are other dumb things too that need to be cleaned up.
But it works!
Pull requests are very welcome.
Usage
var plexApi = ;var plexPinAuth = ; var plexClient = hostname: '192.168.0.1' authenticator: plexPinAuth; // Use getNewPin to get a new PIN object with these parameters:// code: The 4-digit PIN that the user should enter on https://plex.tv/pin to grant authorization// id: the ID of the PIN, which you'll need to use when checking if we have authorization yetplexPinAuth; // Use checkPinForAuth to check to see if the user has entered the PIN on the website yet.// returns a string representing 3 possible results:// "authorized": The user has granted authorization and we now have the token. You can use plexClient now.// "waiting": The user has not yet granted authorization.// "invalid": The PIN is no longer (or never was) valid. PINs only remain valid for about 10 minutes.plexPinAuth;