Jump to content
Pankookis

[SOLVED] Trakt plugin won't let me sync my library (unauthorized)

Recommended Posts

Pankookis

When running the scheduled task "Sync library to Trakt.tv" it fails. If I look at my notifications it says it failed because it was unauthorized. I can "Import playstates from Trakt.tv" and it scrobbles what I'm watching.

 

Have had this issue for about a week now.

 

Emby Server Version 3.2.70.0

 

Trakt plugin 3.1.4.0

 

server-63654040674.txt

Edited by Pankookis

Share this post


Link to post
Share on other sites
kesm

You need to add an Authentification PIN in trakt plugin configuration

Share this post


Link to post
Share on other sites
Pankookis

You need to add an Authentification PIN in trakt plugin configuration

Done this many times.

 

Have uninstalled, restarted, then installed the plugin again and entered a PIN but it's the same.

It's just the Sync library part that doesn't work.

Share this post


Link to post
Share on other sites
Trevor68

OP is correct, was working, now isn't, doing PIN again does not help.

  • Like 1

Share this post


Link to post
Share on other sites
Trevor68

Ah dammit, I missed the first screenshot, will take the log again tonight.

Share this post


Link to post
Share on other sites
Pankookis

@@J2ghz

 

Debug logging checked and I hope this is correct. The log didn't seem to include so much more than before but I'm just a layman :)

 

 

server-63654156403.txt

Share this post


Link to post
Share on other sites
Trevor68

Interestingly my Media Center Master is now failing auth for no particular reason, makes one wonder if trakt are stuffing about with their API again maybe.

Share this post


Link to post
Share on other sites
J2ghz

@@Trevor68 I had a look at the changelog, there seem to be no announced breaking changes and no outages. I also tried to re-authenticate mine just now and it worked. You can also try the steps below.

@@Pankookis 401 Unauthorized at /auth/token according to docs means that the code (in this case PIN) provided was invalid, expired, revoked or already used. Try following these steps with logging on like before:

  1. Go to Trakt plugin configuration page, switch to your user
  2. Click Get PIN, put it in the field, click Save
  3. Go to scheduled tasks, run one of the tasks from Trakt, wait for it to finish, if it says failed send the log.
  4. Start watching something, after a few tens of seconds go to Trakt.tv to check if it says you are watching what you are watching. If it does not, send the log.
Edited by J2ghz

Share this post


Link to post
Share on other sites
Pankookis

@@J2ghz

 

Followed your steps until 3. I can "Import playstates....." but "Sync library....." still fails for me and it says unauthorized

 

 

server-63654235613.txt

Share this post


Link to post
Share on other sites
Pankookis

Solved.

 

Go to .../YOUR USER/Appdata/Roaming/Emby-Server/plugins/configurations/      and delete trakt.xml and then re-authenticate. Find appropriate folder for other OS. 

 

This clear the plugin from all data. Uninstalling the plugin seem to store this file and since the PIN disappear from the plugin setting page there was no way of knowing that it used old data. Why re-authenticating didn't work, I have no idea, but as someone mentioned in another Trakt thread it might for some reason hold the PIN for only 2 months. 

Edited by Pankookis
  • Like 1

Share this post


Link to post
Share on other sites
Trevor68

That would totally explain why the PIN wasn't clearing from the field, will give it a go tonight. The 2 months thing seems valid, as my MCM also stopped validating at the same time.

Share this post


Link to post
Share on other sites
Trevor68

Mine got a bit more involved but eventually by revoking emby from trakt, deleting the plugin and the file, and starting from scratch, it's all fixed. :-)

  • Like 1

Share this post


Link to post
Share on other sites
Pankookis

Mine got a bit more involved but eventually by revoking emby from trakt, deleting the plugin and the file, and starting from scratch, it's all fixed. :-)

 

Yeah, I had already revoked Emby during my hair pulling phase some time before so maybe that was critical too. :)

Share this post


Link to post
Share on other sites
jmedemar

I was fighting with this same issue. Thanks to the help above, I checked my .xml file and found the expiration date of my token was 2-6-18. Even though I had gotten a new token and it saved to the .xml properly, the expiration time field was not updated properly in the .xml

 

If any of the plugin developers are listening in, please check this out in your implementation, as the .xml file is not updating properly when a new token is saved. Thanks everyone for the help!

Share this post


Link to post
Share on other sites
njoak

Solved.

 

Go to .../YOUR USER/Appdata/Roaming/Emby-Server/plugins/configurations/      and delete trakt.xml and then re-authenticate. Find appropriate folder for other OS. 

 

This clear the plugin from all data. Uninstalling the plugin seem to store this file and since the PIN disappear from the plugin setting page there was no way of knowing that it used old data. Why re-authenticating didn't work, I have no idea, but as someone mentioned in another Trakt thread it might for some reason hold the PIN for only 2 months.

 

Awesome, this got my Trakt plugin finally working again. Thanks a bunch!

Share this post


Link to post
Share on other sites
Animosity022

I've read through this a few times. I've tried deleting the plugin and the trakt.xml file a few times and I can't seem to get authenticated.

 

I've got a fresh install on Fedora 27 that I've been trying to get setup.

 

Server logs are attached but they didn't tell me much.

 

 

server-63655538556.txt

Edited by Animosity022

Share this post


Link to post
Share on other sites
digger11

I've been fighting the trakt plugin on my new server install for hours.  A couple of days ago I added a user and linked it to Trakt without any issues.

Today I added a couple of additional users and went through the same process, but their accounts won't sync.  I've tried everything I could think of, including deleting the trakt config xml file, and revoking Emby's connection on my account on the trakt website, and nothing has worked.

 

To see whether it was something peculair to the new server, I even went onto a different server where things were working fine and tried to get a new authentication pin for my account.  The behavior is the same now on that server.

 

The symptom I see is that if I

go into the settings for the  trakt plugin,

select a user

click on "get pin"

log onto trackt

allow Emby to use my account

copy the pin

paste it into the trakt plugin

hit save

go to scheduled tasks

run the import play states from trakt

 

The import fails.

If  I then go back into the trakt plugin settings and look at the user, the pin code I pasted in is still present.

 

 

The errors I see in the log look like the following.

2018-03-01 21:28:12.563 Info HttpClient: POST: https://api.trakt.tv/oauth/token
2018-03-01 21:28:12.689 Error Trakt: Exception handled
	*** Error Report ***
	Version: 3.2.70.0
	Command line: C:\Users\home\AppData\Roaming\MediaBrowser-Server\system\EmbyServer.dll -service
	Operating system: Microsoft Windows NT 6.1.7601 Service Pack 1
	64-Bit OS: True
	64-Bit Process: True
	User Interactive: True
	Processor count: 4
	Program data path: C:\Users\home\AppData\Roaming\MediaBrowser-Server
	Application directory: C:\Users\home\AppData\Roaming\MediaBrowser-Server\system
	MediaBrowser.Model.Net.HttpException: Unauthorized
	   at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.<SendAsyncInternal>d__20.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.<SendAsync>d__17.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<PostToTrakt>d__30.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<RefreshUserAuth>d__26.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<SetRequestHeaders>d__31.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<GetFromTrakt>d__28.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<SendGetAllWatchedMoviesRequest>d__18.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.ScheduledTasks.SyncFromTraktTask.<SyncTraktDataForUser>d__7.MoveNext()
	MediaBrowser.Model.Net.HttpException
	   at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.<SendAsyncInternal>d__20.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.<SendAsync>d__17.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<PostToTrakt>d__30.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<RefreshUserAuth>d__26.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<SetRequestHeaders>d__31.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<GetFromTrakt>d__28.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<SendGetAllWatchedMoviesRequest>d__18.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.ScheduledTasks.SyncFromTraktTask.<SyncTraktDataForUser>d__7.MoveNext()
	
2018-03-01 21:28:12.695 Error Trakt: Error syncing trakt data for user j&j
	*** Error Report ***
	Version: 3.2.70.0
	Command line: C:\Users\home\AppData\Roaming\MediaBrowser-Server\system\EmbyServer.dll -service
	Operating system: Microsoft Windows NT 6.1.7601 Service Pack 1
	64-Bit OS: True
	64-Bit Process: True
	User Interactive: True
	Processor count: 4
	Program data path: C:\Users\home\AppData\Roaming\MediaBrowser-Server
	Application directory: C:\Users\home\AppData\Roaming\MediaBrowser-Server\system
	MediaBrowser.Model.Net.HttpException: Unauthorized
	   at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.<SendAsyncInternal>d__20.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.<SendAsync>d__17.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<PostToTrakt>d__30.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<RefreshUserAuth>d__26.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<SetRequestHeaders>d__31.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<GetFromTrakt>d__28.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<SendGetAllWatchedMoviesRequest>d__18.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.ScheduledTasks.SyncFromTraktTask.<SyncTraktDataForUser>d__7.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.ScheduledTasks.SyncFromTraktTask.<Execute>d__6.MoveNext()
	MediaBrowser.Model.Net.HttpException
	   at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.<SendAsyncInternal>d__20.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.<SendAsync>d__17.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<PostToTrakt>d__30.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<RefreshUserAuth>d__26.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<SetRequestHeaders>d__31.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<GetFromTrakt>d__28.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.Api.TraktApi.<SendGetAllWatchedMoviesRequest>d__18.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.ScheduledTasks.SyncFromTraktTask.<SyncTraktDataForUser>d__7.MoveNext()
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
	   at Trakt.ScheduledTasks.SyncFromTraktTask.<Execute>d__6.MoveNext()
	
2018-03-01 21:28:12.695 Info TaskManager: Import playstates from Trakt.tv Completed after 0 minute(s) and 2 seconds

server-63655536310.txtI

 

 

Edited by digger11

Share this post


Link to post
Share on other sites
Pankookis

I've read through this a few times. I've tried deleting the plugin and the trakt.xml file a few times and I can't seem to get authenticated.

 

I've got a fresh install on Fedora 27 that I've been trying to get setup.

 

Server logs are attached but they didn't tell me much.

Have you tried to revoke the access over at Trakt? You can do that through your settings somewhere, look for a tab called "connected apps" or something similar, delete the Emby token and try again.

 

Trevor68 had to do this and I did it long before I got it to work so I'm unsure of the impact. But it's worth a try.

Share this post


Link to post
Share on other sites
Animosity022

Have you tried to revoke the access over at Trakt? You can do that through your settings somewhere, look for a tab called "connected apps" or something similar, delete the Emby token and try again.

 

Trevor68 had to do this and I did it long before I got it to work so I'm unsure of the impact. But it's worth a try.

 

Since it never makes that first connection to use the PIN, it never shows up in the Connect Apps.

 

Connected Apps is just under Settings->Connected Apps.

Share this post


Link to post
Share on other sites
Pankookis

Since it never makes that first connection to use the PIN, it never shows up in the Connect Apps.

 

Connected Apps is just under Settings->Connected Apps.

Oops. Missed that part. Hope it gets solved soon. 

Share this post


Link to post
Share on other sites
Animosity022

That's identical to my use case and problem as well.

Share this post


Link to post
Share on other sites
Luke

We're looking into this, thanks guys.

  • Like 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...