Authentication token not valid for non-owner Plex Home users

I'm confused how Plex Home uses tokens to authenticate users and I can't get authentication for all users to work. 

Using the following Python script I am able to use the username and password of a Plex user to obtain a token.

import httplib, urllib, base64
username = "insertanyusernamehere"
password = "insertcorrespondingpasswdhere"
base64string = base64.encodestring('%s:%s' % (username, password)).replace('
', '')
txdata = ""

headers={‘Authorization’: “Basic %s” % base64string,
‘X-Plex-Client-Identifier’: “Test script”,
‘X-Plex-Product’: “Test script 356546545”,
‘X-Plex-Version’: “0.001”}

conn = httplib.HTTPSConnection(“plex.tv”)
conn.request(“POST”,"/users/sign_in.json",txdata,headers)
response = conn.getresponse()
print response.status, response.reason
data = response.read()
print str(data)
conn.close()

The script returns some user info, including a token. Next, I try to use the token to access the Plex API with the following script:

import httplib, urllib, base64

token = "INSERTTOKENHERE"

txdata = “”

headers={‘X-Plex-Client-Identifier’: “Test script”,
‘X-Plex-Product’: “Test script 356546545”,
‘X-Plex-Version’: “0.001”,
‘X-Plex-Token’: token}

conn = httplib.HTTPConnection(":32400")
conn.request(“GET”,"/library",txdata,headers)
response = conn.getresponse()
print response.status, response.reason
data = response.read()
print str(data)
conn.close()

When I enter the account credentials of the server's owner in the first script and insert the corresponding token into the second script, I get some info about the libraries on the Plex server, as expected. However, when I enter the credentials of any other Home user the first script returns a token successfully, but the second script returns a 401 Unauthorized error.  

 

Can someone tell me what I've been doing wrong?

 

I followed the instructions in this thread and posted my question there too, but I received no help there. 

I am experiencing the same issue. Did you ever figure out what the problem was or the correct method to implement non owner accounts?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.