PlexTraktSync icon indicating copy to clipboard operation
PlexTraktSync copied to clipboard

Feature request: Trakt ID/Secret/PIN in config

Open bakes82 opened this issue 2 years ago • 16 comments

Ability to set the trakt ID/Secret/PIN in the config so you can run in dockers where you dont get SSH access.

Run 1 - Trakt ClientID/Secret in config

  • Script will error not authed - put auth URL in log. Run 2 - Add PIN to config
  • Script removes pin once authed its 1x so not a big deal if not

bakes82 avatar Mar 24 '22 04:03 bakes82

@glensc You think you can pop this in, would be huge improvement for remote hosting and what not.

bakes82 avatar Mar 24 '22 04:03 bakes82

@bakes82 I don't even understand what are you talking about here, even its English words. you assume too much I know about your workflow. you need to describe what are you doing (as precisely as possible, and reproducible) and what you expect to happen (as precisely as possible). also you totally discarded issue template which we made so that people fill necessary details and don't create issues like you made now.

glensc avatar Mar 24 '22 11:03 glensc

He wants unattended install. Same problem for Plex, right ?

simonc56 avatar Mar 24 '22 13:03 simonc56

Workaround is to do the first run on another computer where you have console access to perform the interactive setup. Then copy .env and .pytrakt.json files (contains plex & trakt auth tokens) to the remote computer.

simonc56 avatar Mar 24 '22 13:03 simonc56

Correct, the current process doesnt work for dockers where you dont have shell access. I dont want to install python and run a bunch of crap just to "auth" an app when I can generate the authorized pin before hand and just pass it as a config option.

Plex Meta Manager just implemented it per request so Im asking for the same thing here .

REF Code https://github.com/meisnate12/Plex-Meta-Manager/commit/2c602557ed0da14d96c8d97cc0208d93a36d44cb

Navigate to https://trakt.tv/oauth/authorize?response_type=code&redirect_uri=urn:ietf:wg:oauth:2.0:oob&client_id=<<CLIENT_ID>> replacing <<CLIENT_ID>> with your Client ID. 7. Record the PIN as pin in your Configuration File.

bakes82 avatar Mar 24 '22 19:03 bakes82

as @twolaw said, run the process elsewhere and copy the files. adding "docs needed" label, so documentation update pr for this is wanted.

glensc avatar Mar 25 '22 15:03 glensc

This doesnt fix the issue when I cant upload files to my docker host, I can only edit the one file they expose to me.

bakes82 avatar Mar 25 '22 17:03 bakes82

Unclear statement:

  • https://github.com/Taxel/PlexTraktSync/issues/845#issuecomment-1079241470

glensc avatar Mar 26 '22 14:03 glensc

Im not sure what you dont understand. This isnt a documentation issue, this is a feature request to allow authing via pin from the config. Not sure why you are telling me work arounds, thats not what Im looking for, I know of them already. My users dont use python, we want to put this as part of a docker image with other things, and only expose the config file for them to edit. They cant ssh, they cant upload files, they get a webpage with the ability to edit the config file.
Unless we could store the json thats in the other two files as elements in the config and then if they arent null they are written to the other two files or what not. Its not as easy a pin auth but maybe its easier? Again not sure the PMM people thought was a fine idea to do pin auth so not sure what your hang up about it is. Its something that solves problems when you cant run in interactive mode and then you dont need to run it on another machine, kind of defeats the point of remote hosting.

bakes82 avatar Mar 28 '22 04:03 bakes82

responding to the wall of text without reading it: pin auth is interactive. you can't do that with filling files, as to fill file you need to restart the process and if you restart the process the pin auth session is aborted.

it's an accepted solution to do authentication elsewhere and then copy the session files to the other instance.

adding "docs needed" label, so someone can contribute documenting the process it to readme.md.

glensc avatar Mar 28 '22 07:03 glensc

Pin auth is not officially supported anymore. The device auth workflow (used in PlexTraktSync) is to enter a locally generated code on https://trakt.tv/activate before the 10min expiration time.

A solution can be an opt-in to make the script write this code in a file and remember the device_code. Then the user would have to read this file and enter the code on the activate webpage then relaunch the script within 10 mins. Quite complicated.

image

simonc56 avatar Mar 28 '22 08:03 simonc56

When I say "pin" Im meaning the auth code from the activate url. You can get this "code/pin" before the code runs since you know the URL and your clientid, this code remains valid for 1 login attempt (possible 10min limit ive never gone beyond 1min). So a user can go to it before even running the app, copy it, put it in the config, and then run the app, at which point you could use it to login and generate the other two files you need as normal. Honestly it not any more complicated then making an api in trakt lol than you need to copy it in to the config file, plus it can all be done at the same time before it runs as you put in the id/secret. Pin would be optional for non interactive mode.

Youre all about people reading the doc, so just like they did you add this for optional non interactive mode: Navigate to https://trakt.tv/oauth/authorize?response_type=code&redirect_uri=urn:ietf:wg:oauth:2.0:oob&client_id=<<CLIENT_ID>> replacing <<CLIENT_ID>> with your Client ID. Record the PIN as pin in your Configuration File.

bakes82 avatar Mar 28 '22 17:03 bakes82

@twolaw Just to follow up on this I was doing the new PMM pin auth process, Track calls the device auth code a "PIN" image

Also the process of authing a device is actually built in to the trakt ui screen when you make a new api you press the magic authorize button, so the process is even simpler lol image

bakes82 avatar Apr 01 '22 04:04 bakes82

You're right, the workflow is easy with this Authorize button in web UI. But it invokes the pin auth method which is not officially supported (and not recommended) anymore.

I'll see if this very specific use case can be added without creating a mess in the setup process for the average user. We want to keep the readme as simple as possible.

simonc56 avatar Apr 01 '22 08:04 simonc56

plex-login has --password="$PLEX_PASSWORD" command line argument.

glensc avatar Nov 20 '22 18:11 glensc

similar --client-id and --client-secret could be added to trakt-login:

  • https://github.com/Taxel/PlexTraktSync/blob/025a8622acf9ce6bd75609b7065354c54cf978ee/plextraktsync/commands/trakt_login.py#L33-L34

glensc avatar Nov 20 '22 18:11 glensc