myplex: authenticating use the "PIN method"

Hi,

 

Hoping someone here might be able to answer this for me, as I've not been able to work it out (or discover from looking at the PHT or roku client code).

 

I want to authenticate against myplex using the https://plex.tv/pinmethod.  I can request the PIN page, get the code and the id number of the request (a POST into http://plex.tv/pins.xml) - but I can't get the authentication code from the response page.

 

I know I need to get the data from https://plex.tv/pins/.xml- but I always get a 422.  I use the same header information as used in the initial POST, so I guess that I'm supposed to send some information i the header, but I'm not sure what!  I've tried both a GET and a POST on this just in case.

 

Anyone help?

 

EDIT: ahhh - got it. Knew that would happen as soon as I posted.  For anyone interested (https://xkcd.com/979/) the correct method was a get (found from the PHT client), but I was also adding the parameter information as URL arguments, when I should have been using HTTP Headers.    Switch it round and worked first time...

Nice I'm about to try this out!

Nice I'm about to try this out!


Feel free to check out my Python code if you like:
https://github.com/hippojay/plugin.video.plexbmc/blob/helix/resources/lib/plex.py

Sweet I'll check it out. I got the basics down into an npm module https://www.npmjs.com/package/plex-pin 

I plan on using this in a Meteor.JS application that needs an auth token for pms. Thanks for solving this, much appreciated!

I believe https://plex.tv/pins/.xml is a GET request not a POST request, also make sure you have set your accept headers to application/xml

Thanks finally figured it out!