Need Help Getting A Plex Token For Access

I need help getting a token to access my server.

I use Linux on everything, and I have Home Assistant running fine. It wants to set up Plex, but I need a token for it. Can someone tell me what I need to type into the terminal to return a token I can use. I just need one permanent token for this application to remotely access my server, but it is pretty confusing from all the stuff I’ve read.

It seems like this should be a button on the devices page of your account, but I digress.

Thanks!!

https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/

Right. Now how do I…

"Do a HTTP POST request to https://plex.tv/users/sign_in.json (or https://plex.tv/users/sign_in.xml ) with:

  • user[login] and user[password] form values in the body. For example: user%5Blogin%5D=plexusername&user%5Bpassword%5D=myplexpassword
  • HTTP header: X-Plex-Client-Identifier : a unique value for your client
  • HTTP header: X-Plex-Product : the name of your client
  • HTTP header: X-Plex-Version : the version of your client"

We need the english example, not the code instructions for developers. Any help would be great.

You only need to read the first paragraph, because this is all you need to get a token.

I’m not getting this…

If I’m in a terminal on Linux, what would I type?

You can’t get it in a terminal, AFAIK.

Actually, you can :wink:

#!/bin/sh

read -p 'plex.tv Username: ' uservar
echo ''
read -sp 'plex.tv Password: ' passvar

url="https://plex.tv/api/v2/users/signin?login=$uservar&password=$passvar&X-Plex-Client-Identifier=12345abcDEF"
response=$(curl -X POST -i -k -L -s $url)
# Grap the token
UserToken=$(printf %s "$response" | awk -F= '$1=="authToken"{print $2}' RS=' '| cut -d '"' -f 2)

echo "************************* Token *******************************************"
echo $UserToken
echo "***************************************************************************"
1 Like

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