trakt / Plex-Trakt-Scrobbler

Add what you are watching on Plex to trakt.tv
1.44k stars 167 forks source link

Unable to sync [Unable to retrieve account details from plex.tv] #611

Open arabcoders opened 2 years ago

arabcoders commented 2 years ago

Hello,

Syncing from plex stopped few days ago, while still working in jellyfin. i searched the logs and it seems for reason the plugin is unable to get the plex account.

2021-10-06 14:45:34,284 - plugin.models.m_plex.account     (7fcf495dab38) :  INFO (plugin.models.m_plex.account:118) - Refreshing plex account: <PlexAccount username: u'my-username'>
2021-10-06 14:45:34,798 - plugin.models.m_plex.account     (7fcf495dab38) :  WARNING (plugin.models.m_plex.account:126) - Unable to retrieve account details from plex.tv (status_code: 422)

and this message kept on being repeated every time the server tries to sync.

[17 minutes ago] AccountAuthenticationError: Plex account is missing the server token

things 1 did.

  1. remove every trace of the plugin and reinstall. - failed same issue
  2. disclaim the server and reclaim. - nope same issue
  3. re-authorize the plugin via trakt.tv.
arabcoders commented 2 years ago

I was able to get new items I watch on plex to be marked at trakt.tv but I can't pull down all my watched status from trakt.tv, any thoughts on how to force the pull or to sync from them?

it wont pull old items you have to use kitana to force pull and push.

thanks for the note!

I took a look at this https://github.com/pannal/Kitana - is that the kitana you are talking about?

Yes it would expose your plugin hidden interface where you can do lots of things.

blindguy commented 2 years ago

I was able to get new items I watch on plex to be marked at trakt.tv but I can't pull down all my watched status from trakt.tv, any thoughts on how to force the pull or to sync from them?

it wont pull old items you have to use kitana to force pull and push.

thanks for the note! I took a look at this https://github.com/pannal/Kitana - is that the kitana you are talking about?

Yes it would expose your plugin hidden interface where you can do lots of things.

Worked perfectly!!! thanks so much!

paul-michael commented 2 years ago

Trakt syncing broke for my first/primary Plex user as well. Checked and noticed that it had lost authentication to Plex (no green check mark). I authenticated again but it would eventually lose it again specially after a Plex restart. Did Method #2 and so far still working even after multiple Plex restarts.

Just wondering if the Plex token expires (how long if ever) and if I have to constantly check if authentication is lost and update the env variable in plex docker container. Either way, great job and thank you very much!

arabcoders commented 2 years ago

I was able to get new items I watch on plex to be marked at trakt.tv but I can't pull down all my watched status from trakt.tv, any thoughts on how to force the pull or to sync from them?

it wont pull old items you have to use kitana to force pull and push.

thanks for the note! I took a look at this https://github.com/pannal/Kitana - is that the kitana you are talking about?

Yes it would expose your plugin hidden interface where you can do lots of things.

Worked perfectly!!! thanks so much!

@blindguy Glad to hear it works for you mate.

Trakt syncing broke for my first/primary Plex user as well. Checked and noticed that it had lost authentication to Plex (no green check mark). I authenticated again but it would eventually lose it again specially after a Plex restart. Did Method #2 and so far still working even after multiple Plex restarts.

Just wondering if the Plex token expires (how long if ever) and if I have to constantly check if authentication is lost and update the env variable in plex docker container. Either way, great job and thank you very much!

@paul-michael As far as i know, the token only expires if you re-add the server or add new one, i only had to change it once when i re-claimed the server in top post.

jasimancas commented 2 years ago

@ArabCoders The token is temporary: https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/

In the end you have to be aware of whether the token changes or not to edit the py file or the environment variable. A bit cumbersome, some tokens have lasted me only 3 days.

BTW: Thanks you!

olliebean commented 2 years ago

I've just been using https://trakt-for-plex.github.io/configuration/#/configuration/accounts to re-authenticate Plex when necessary. I don't know whether hardcoding the token lasts any longer than that, but it's a lot easier to re-authenticate on a web page than to find the token in an xml file and copy it into account.py (or into an environment variable) every time it changes.

arabcoders commented 2 years ago

@jasimancas

@ArabCoders The token is temporary: https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/

In the end you have to be aware of whether the token changes or not to edit the py file or the environment variable. A bit cumbersome, some tokens have lasted me only 3 days.

BTW: Thanks you!

@olliebean

I've just been using https://trakt-for-plex.github.io/configuration/#/configuration/accounts to re-authenticate Plex when necessary. I don't know whether hardcoding the token lasts any longer than that, but it's a lot easier to re-authenticate on a web page than to find the token in an xml file and copy it into account.py (or into an environment variable) every time it changes.

I'm not sure what are you guys doing to force X-Plex-Token regeneration, since i posted this issue, i haven't had token change ever. and before this issue for almost an entire year or maybe more it didn't change. the one time i had it changed is when i disclaimed the server and re-added it again. Something is up with your setups.

jasimancas commented 2 years ago

I have added my token to the file again, let's see if I solve the problem.

jasimancas commented 2 years ago

News, the token has changed again, but it is not only that, but from the PC gives me a token, from the mobile another different token in the same XML in the same pelicular, at the same time, and in the Tablet another different one, so I have 3 tokens at the same time, which makes that the one I add in the .py is not worth anything, in fact, I add it and just a couple of hours later I get the error in Kitana.

Any idea @ArabCoders?

arabcoders commented 2 years ago

News, the token has changed again, but it is not only that, but from the PC gives me a token, from the mobile another different token in the same XML in the same pelicular, at the same time, and in the Tablet another different one, so I have 3 tokens at the same time, which makes that the one I add in the .py is not worth anything, in fact, I add it and just a couple of hours later I get the error in Kitana.

Any idea @ArabCoders?

@jasimancas Hmmm, i honestly don't know why the token keep changing for you, my setup is quite simple for plex being reverse proxied via Nginx. all my clients be it phone, tablets, tabletop devices and PC all share the same token. do you use the same account for all those devices or do you have mutli-account? this maybe why the token keep changing.

jasimancas commented 2 years ago

Same account for all devices, I always log in with the same one, I have changed password, logged out of all and logged back in and again same problem.

PD: Sorry

arabcoders commented 2 years ago

Misma cuenta para todos los dispositivos, siempre inicio sesión con la misma, de hecho he cambiado contraseña, cerrado sesión en todos y vuelta a iniciar y de nuevo mismo problema.

@jasimancas i am sorry i don't understand Spanish, going by google translation, it seems you use the same account on all devices thats nice. i think you might have plex misconfigured somewhere. Do you use plex in docker or direct install? make sure the data path is valid and has correct uid:guid

refers to this may help https://www.reddit.com/r/PleX/comments/4qdjt7/help_plex_media_server_xplex_token_resets_each/

jasimancas commented 2 years ago

Maybe this? image

arabcoders commented 2 years ago

Maybe this? image

thats what the maintainer need to do to permanently fix this problem on new releases. for now your problem feels different.

jasimancas commented 2 years ago

correct, but it says that each client has its own token, it is just what happens to me, depending on where I log in I get a token, token that I put in the .py, I restart and after a few minutes I get the error again.

olliebean commented 2 years ago

I'm not sure what are you guys doing to force X-Plex-Token regeneration, since i posted this issue, i haven't had token change ever. and before this issue for almost an entire year or maybe more it didn't change. the one time i had it changed is when i disclaimed the server and re-added it again. Something is up with your setups.

My token doesn't seem to be changing, but instead of using the token I was using https://trakt-for-plex.github.io/configuration/#/configuration/accounts to re-authenticate, and I found I was having to do it again every time Plex had been restarted. So now I've edited the account.py file - I couldn't get the environment variable to work, so I've hardcoded the token into the file, which seems to be working (https://trakt-for-plex.github.io/configuration/#/configuration/accounts is showing a green tick next to Plex, and syncs in Kitana are working fine with no missing server token error).

fent commented 2 years ago

i haven't refreshed my token since i posted here ~20 days ago, and i'm not using trakt-for-plex

arabcoders commented 2 years ago

It might have something to do with trakt-for-plex app or something. i think

CBarbas commented 2 years ago

HI all,

quick question guys, should we wait for the plugin update or is it worth it to do manual changes in order this to work again?

Thank you

arabcoders commented 2 years ago

HI all,

quick question guys, should we wait for the plugin update or is it worth it to do manual changes in order this to work again?

Thank you

I would do the manual edit and update once the maintainer fixes the issue.

CBarbas commented 2 years ago

Hi again,

thanks for the reply and I just want to be sure that what I am doing its correct,

I'll have to open the "account.py" file and replace this line, "env_token = os.environ.get('PLEXTOKEN')"

with those,

env_token = os.environ.get('PLEXTOKEN')

    env_token = '***h****X****y_****1***'

where '*hXy_***1' its my PLEX Token and I mean exactly as they look above by your post and changing only the Token, correct?

After that and when I'll watch a TV Show episode it should be sync and cashed when I open the Trekt.Tv at my browser, also correct?

Thank you

arabcoders commented 2 years ago

Hi again,

thanks for the reply and I just want to be sure that what I am doing its correct,

I'll have to open the "account.py" file and replace this line, "env_token = os.environ.get('PLEXTOKEN')"

with those, #env_token = os.environ.get('PLEXTOKEN') envtoken = 'h_Xy__1**_'

where '_h_Xy__1**_' its my PLEX Token and I mean exactly as they look above by your post and changing only the Token, correct?

After that and when I'll watch a TV Show episode it should be sync and cashed when I open the Trekt.Tv at my browser, also correct?

Thank you

Correct, you have to follow the steps and be mindful of the whitespace as it's important please refers to this post

https://github.com/trakt/Plex-Trakt-Scrobbler/issues/611#issuecomment-936738723

CBarbas commented 2 years ago

Hm,

I am not familiar with "whitespace", I hope I've done it well but I will report back anywise to report my outcome!

Thanks

CBarbas commented 2 years ago

So coming back to report that

I have watched a documentary and it is synchronized and marked as "viewed" at trakt.tv. At the other hand I watched 3 tv shows/series episodes and none has synch! I have to tell you that I am using also the new "PLEX Naming and Organizing Your TV Show Files", details here but I assume you already know about it!

Halfway there, can I do something about it?

Thanks

tixetsal commented 2 years ago

I switched to the paid version of the scrobbler for a year, while this hopefully gets sorted... On Dec 12, 2021, 7:58 AM -0700, CBarbas @.***>, wrote:

So coming back to report that I have watch a documentary and it is synchronized and marked as viewed" at trakt.tv. At the other hand I watched 3 series episodes and none has synch! I have to tell you that I am using also the new "PLEX Naming and Organizing Your TV Show Files", details here but I assume you already know about it! Can I do something? Thanks — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

arabcoders commented 2 years ago

So coming back to report that

I have watched a documentary and it is synchronized and marked as "viewed" at trakt.tv.

At the other hand I watched 3 tv shows/series episodes and none has synch!

I have to tell you that I am using also the new "PLEX Naming and Organizing Your TV Show Files", details here but I assume you already know about it!

Halfway there, can I do something about it?

Thanks

you may have to use kitana to force push the watch state if you watched them and they didn't sync.

and about trakt.tv premium it does not solve the problem as its one-way sync not two-way.

CBarbas commented 2 years ago

OK,

I understand, I will do the series synch manually from now on till an updated plugin version comes out. I also have the problem with the smart tv PLEX app which is no longer log in due the server security changes PLEX has applied for the older SAMSUNG smart tv's but that's not worry me at all, synch is my top listed problem.

Thanks for the help, appreciated.

arabcoders commented 2 years ago

OK,

I understand, I will do the series synch manually from now on till an updated plugin version comes out.

I also have the problem with the smart tv PLEX app which is no longer log in due the server security changes PLEX has applied for the older SMSUNG smart tv's but that's not worry me at all, synch is my top listed problem.

Thanks for the help, appreciated.

No problem. you don't have to manually sync after applying the fix its only for items that was queued to be synced before applying the fix.

And for samsung plex app i think you have to disable ssl in server settings.

CBarbas commented 2 years ago

Do

you mean that new series episodes at my library will synch, I have just added 2 or 3, I'll report back about that. About the ssl setting, its not only that as I have read which by the way wasn't active by me, still isn't or other which have the problem since last PLEX version.

arabcoders commented 2 years ago

Do

you mean that new series episodes at my library will synch, I have just added 2 or 3, I'll report back about that.

About the ssl setting, its not only that as I have read which by the way wasn't active by me, still isn't or other which have the problem since last PLEX version.

the default SSL setting is preferred for Plex server you have to explicitly disable ssl to make old client works.

CBarbas commented 2 years ago

Where should I change it, at PLEX via the web browser, settings/network, right? Will that be enough?

arabcoders commented 2 years ago

Where should I change it, at PLEX via the web browser, settings/network, right?

Will that be enough?

i think so yeah check

https://forums.plex.tv/t/important-information-about-plex-for-smart-tvs-after-september-30-2021/746506

rg9400 commented 2 years ago

To fix this issue, you just need to use the version in this PR. It's unclear when it will be merged since the maintainers aren't around. It grabs the token automatically from the settings without any further user intervention needed.

https://github.com/trakt/Plex-Trakt-Scrobbler/pull/615

CBarbas commented 2 years ago

Where should I change it, at PLEX via the web browser, settings/network, right? Will that be enough?

i think so yeah check

https://forums.plex.tv/t/important-information-about-plex-for-smart-tvs-after-september-30-2021/746506

My settings are like those at the post but what is happening, not only be me, is that the app doesnt provide a PIN to link the account.

Check the links, https://forums.plex.tv/t/plex-tv-link-not-generating-code-on-samsung-smart-tv/763431 https://forums.plex.tv/t/samsung-tv-cannot-connect-to-plex/650100/8

jeff15110168 commented 2 years ago

Hello - I was in the process of replacing my trakttv.bundle to fix the TV scrobbling issue referenced here: https://github.com/trakt/Plex-Trakt-Scrobbler/issues/596 ; but now i have lost the ability to communicate with the trakt plugin using either Kitana and the web interface (http://trakt-for-plex.github.io/configuration/#/connect). Does anyone know how to fix this using Unraid with Docker (Plex and Kitana are separately installed containers in Docker)?

image

image

jeff15110168 commented 2 years ago

Hello - I was in the process of replacing my trakttv.bundle to fix the TV scrobbling issue referenced here: #596 ; but now i have lost the ability to communicate with the trakt plugin using either Kitana and the web interface (http://trakt-for-plex.github.io/configuration/#/connect). Does anyone know how to fix this using Unraid with Docker (Plex and Kitana are separately installed containers in Docker)?

image

image

Hmm I was able to suddenly get access to both kitana and the web interface, without doing any changes (both error messages suddenly went away). But now real-time scrobbling isn't working (no playback progress is showing in the trakt iOS app, which previously used to show when i started watching a movie). Any idea what to do to fix this? I'm using Corningman's fork of Trakt Plugin which allows for scrobbling TV shows correctly.

CBarbas commented 2 years ago

OK, I understand, I will do the series synch manually from now on till an updated plugin version comes out. I also have the problem with the smart tv PLEX app which is no longer log in due the server security changes PLEX has applied for the older SMSUNG smart tv's but that's not worry me at all, synch is my top listed problem. Thanks for the help, appreciated.

No problem. you don't have to manually sync after applying the fix its only for items that was queued to be synced before applying the fix.

And for samsung plex app i think you have to disable ssl in server settings.

Hi,

You were right, new series episodes addition to the library has ynch, also movies the same, I am happy with that at the time, log in at the PLEX doesnt bothers me at all.

Out of curiosity, why old series episodes at the library will not synch?

Your fix has worked for me 100%, thank you very much.

arabcoders commented 2 years ago

To fix this issue, you just need to use the version in this PR. It's unclear when it will be merged since the maintainers aren't around. It grabs the token automatically from the settings without any further user intervention needed.

615

indeed that sounds better fix overall, hope it get merged at some point.

@jeff15110168 sorry i have no idea.

Hi,

You were right, new series episodes addition to the library has ynch, also movies the same, I am happy with that at the time, log in at the PLEX doesnt bothers me at all.

Out of curiosity, why old series episodes at the library will not synch?

Your fix has worked for me 100%, thank you very much.

I think it has something to do with the retry logic in traktv plugin not sure why though, Anyway doing one time manual push from kitana fixes the issue so far. I just hope there will be an alternative selfhosted sync system.

CBarbas commented 2 years ago

This "kitana" plugin works also for users without subscription? And if the answer is yes, can we use it together with the plugin from here or it will mesh things up?

Thanks

arabcoders commented 2 years ago

This "kitana" plugin works also for users without subscription? And if the answer is yes, can we use it together with the plugin from here or it will mesh things up?

Thanks

i am talking about this app https://github.com/pannal/Kitana you can download it and it will expose hidden plugin settings.

jeff15110168 commented 2 years ago

Hello - I was in the process of replacing my trakttv.bundle to fix the TV scrobbling issue referenced here: #596 ; but now i have lost the ability to communicate with the trakt plugin using either Kitana and the web interface (http://trakt-for-plex.github.io/configuration/#/connect). Does anyone know how to fix this using Unraid with Docker (Plex and Kitana are separately installed containers in Docker)? image image

Hmm I was able to suddenly get access to both kitana and the web interface, without doing any changes (both error messages suddenly went away). But now real-time scrobbling isn't working (no playback progress is showing in the trakt iOS app, which previously used to show when i started watching a movie). Any idea what to do to fix this? I'm using Corningman's fork of Trakt Plugin which allows for scrobbling TV shows correctly.

Just as an update, i installed @Cornishman's latest release mentioned in the other thread #596 (see below) and it fixed all my issues.

@jeff15110168 Try this branch instead, direct zip link. It's a separate branch that includes both my fix from here as well as the PlexOnlineToken fix pending in #615.

Let me know how you get on 👍

gitthangbaby commented 2 years ago

i've tried changing account.py file, disconnecting/reconnecting, updating the module, restarting Plex and the config Plex flag wasn't green and the login disappeared after just a page refresh, while plugin log showed error: Exception raised in sync task: Plex account is missing the server token ......until i pressed SAVE button in the top right of the UI: https://trakt-for-plex.github.io/configuration Now i see Trakttv showing me i'm watching something and the flag in the configuration is green. Interestingly, Interval value is consistently not the same as in the plugin setting. Thanks for the advice, I didn't notice as I have this script running each day.

CBarbas commented 2 years ago

Hi and Happy New Year everyone.

Today I couldn't access my PMS PC Server from my SAMSUNG TV and I was getting very mad! I have try to remember what I have done the last time that this was occurred, searched around the internet a little, done it also by PLEX Forums to see if anything is going on.

I couldn't find something and I actually didn't changed anything at all form yesterday that it has worked fine, the only difference from the past, far past, is that I wasn't able to login due to the PLEX server security changes that has effect all SAMSUNG and more, SMART TV users with older than 2014, if I am not mistaken, tv models.

Trying to find out what's gong on all guides and posts suggested of course that you have to be logged in in order access and check if everything is OK by the server.

The problem is that I cannot do that as I have described above but still the server was accessible since yesterday for me and others I suppose with older SMART TVs.

Then I have just say why am I not trying to log in by the TV App and BAM access was enabled again, 4 PIN etc worked as it should be and I have access again.

Did they changed anything, I am curious because this problem has effected many users which have older SMART Tvs. It seems that something like that is going on!

wax911 commented 2 years ago

Happy to say https://github.com/Cornishman/Plex-Trakt-Scrobbler fork works like a charm

arabcoders commented 2 years ago

Thanks All. i added link to the fork in my 2nd Q&A post to hopefully direct people there if they are not too comfortable to manually do the fix. Hopefully the core maintainers will incorporate the changes.

adambirds commented 2 years ago

I've reinstalled via the https://github.com/Cornishman/Plex-Trakt-Scrobbler fork. But I'm still getting the server token error. Any ideas @ArabCoders?

arabcoders commented 2 years ago

@adambirds : I've reinstalled via the https://github.com/Cornishman/Plex-Trakt-Scrobbler fork. But I'm still getting the server token error. Any ideas @ArabCoders?

Sorry i have no idea why it's not working for you. try doing the manual steps on the original plugin and see if it's works for you. otherwise @Cornishman might have an idea on why it's not working.

adambirds commented 2 years ago

@ArabCoders it turns out it was due to the fact that the fix isn't merged into master on @Cornishman's fork and instead in a seperate branch which isn't made clear above, but don't see a reason as to why it isn't in master.

arabcoders commented 2 years ago

@adambirds : @ArabCoders it turns out it was due to the fact that the fix isn't merged into master on @Cornishman's fork and instead in a seperate branch which isn't made clear above, but don't see a reason as to why it isn't in master.

Good catch, I'll go ahead and update the link in Q&A post.

whitaar commented 2 years ago

Syncing worked great with hardcoding my plex token in account.py until a recent plex server update to 1.26. I tried Cornishman's fork (the separate branch per @adambirds ) and still nothing. Does it matter that plexonlinetoken from windows registry doesn't match my plex token from the XML files? Scrobbling works, just not syncing collections.