The subject line says it all really.
I can get an x-plex-token for one of my plex home users from plex.tv, but trying an operation such as listing the library sections as that user gives me a 401.
Anyone had/solved this?
I've just spent a while looking through plex2csv to see if those folks solved it but it looks like that code for that only needs the plex owner to work.
(This may be a duplicate of this similar unanswered question)
Start by sharing some code here.....And FUI, Plex2CSV just got all token code removed, since it no longer needed it, since it's now a pure local PMS app only, and only use the buildin framework ;)
Thanks Dane:
$.ajax({
headers:{
'Authorization' : 'Basic '+userpass, // I'm assuming this needs passed in again along with the token from plex.tv
'X-Plex-Client-Identifier' : 'RobsPlexWebClient-1',
'X-Plex-Product' : 'RobsPlexWebClient',
'X-Plex-Version' : '1',
'X-Plex-Device-Name' : 'RobsPlexWebClient-1',
'X-Plex-Token': authcode, // this is the token from plex.tv
'Accept' : 'application/json'
},
type: 'get',
url: 'http://192.168.0.14:32400/library/sections',
success: function(result){
$.each(result._children,function(count,child){
$('#output').append(child.title+"
");
});
},
error : function(xhr,textStatus,errorThrown){
$('#output').append('ERROR: '+xhr.status+' '+textStatus+' '+errorThrown+'
');
}
});
First sign in as the owner with the token....
Then do a get towards:
https://plex.tv/api/home/users
Find the user you wanna sign in as, and send the following, and still with your token in the header as a POST
https://plex.tv/api/home/users/<IDof Home User>/switch
(Here the other std. header stuff also needs to be present, like the X-Plex-Client-Identifier)
Above should return a token you can use for further access, like you would with a regular token
/Tommy
I guess you’ve figured this out by now, but for others who went looking like me 
There’s one more step to get the right token to use.
As above if you access the servers using the token returned from the switch you’ll get an unauthorised response.
You need to take the returned PlexTV token and check what resources the user has access to and use the respective token for the resource.
So after switching access this url with the users token:
https://plex.tv/api/resources?includeHttps=1&X-Plex-Token=
Then get the “accessToken” for the respective device(s).
This is the token that should be then be used.