Jump to content
Shilow

Kodi Profiles and Emby Authentication

Recommended Posts

Shilow
Emby Server 3.5.2.0 on QNAP (x64)

Kodi 17.6 on Windows 7 x64 Pro

-Logs can be provided if needed-

I have two users setup on Emby and matching profiles in Kodi.  The Kodi plugin is installed on the server.

 

Issue:

Anytime Kodi switches profiles (user1 to user2 -or- user2 to user1) the message of Emby Authentication Failed is displayed, and the user is prompted to type in the password again.

 

Example:

User1 uses the User1 profile in Kodi, prompted to authenticate. Once authenticated, sync happens and no issues. If User1 closes and reopens Kodi, sync happens. No authentication prompt, and everything works as expected.  User1 Kodi profile continues to function perfectly as expected, no matter how many times Kodi is reopened, until...

User2 loads User2 profile.  User2 is prompted to authenticate. Like User1, everything works as expected from then on. If User2 continues to reopen Kodi, no issues just like User1.

 

If User1 opens Kodi (after User2), the whole process starts over with authentication.

If User2 opens Kodi (after User1), again, the whole process starts over with authentication.

 

All media is displayed properly, and all sync's occur properly, the issue is the re-authentication if you were not the last person using the system.

It is like Kodi is only saving one password, the last password entered, and trying to use it for every user.

 

Additional Details:

This started around July 29th, I believe that is when I upgraded Emby to the current version (3.5.2.0). It was using the direct previous version before it. I keep my system current.

 

This occurs on 4 different computers with existing Kodi installations.

I've clean installed a fresh Kodi setup, with Emby Add-on only, still occurs.

I've reinstalled Emby server over itself, still occurs.

I've delete and recreated the user accounts on the Emby Server itself, still occurs.

 

I'm about to remove Emby Server entirely from the QNAP, and clean install it on the server.

Since the media scan will take forever on my large collection, I thought I would ask for assistance first.

 

I’m a lifetime Emby Premiere user and have been enjoying the work that has been done on the project for several years.

 

Thank you for the project and any assistance that can be provided.

 

Share this post


Link to post
Share on other sites
Angelblue05

It's probably an issue with kodi profiles. I'll look into it but for the time being, why not install embycon? This way you can access your content on other Kodi profiles.

 

If I had to guess, it's probably loading the wrong settings/auth info when switching profile.

Edited by Angelblue05

Share this post


Link to post
Share on other sites
nuentes

I've noticed this too, and was about to make a post and decided to piggyback on this thread. I even went so far as to wipe my Master Profile, and create a new profile, thinking it was some sort of corruption on that specific profile. I've noticed some other weirdness about kodi profiles, so it is very possible this is on the kodi end. I feel live I've noticed other times where settings will disappear from one profile and migrate to another. I can't explain it at all. I feel like this is kodi, but I can't be sure. I'm not sure if I should just downgrade to a lower version of 17.

 

here is my log (I have the same versions of each app as OP) https://paste.kodi.tv/celelojeti

 

Basically what I did was create a brand new profile (I planned to stop using the master profile for the most part), login to emby on the new profile and let it fully load. Then, on all other profiles I returned all settings to default to prompt a re-login request. I then restarted kodi and logged back in to emby on all profiles. I then closed Kodi again and reopened, and this is the log file from that kodi run. You can see that both profiles get a "Not authenticated yet" error message. All my emby accounts have no password, so I just click Sign In, but it's quite aggrivating.

Share this post


Link to post
Share on other sites
Shilow

It's probably an issue with kodi profiles. I'll look into it but for the time being, why not install embycon? This way you can access your content on other Kodi profiles.

 

If I had to guess, it's probably loading the wrong settings/auth info when switching profile.

 

Update.

I removed Emby Server from my QNAP.

SSHed in, made sure it was completely gone and rebooted the QNAP.

Re-Downloaded the same version source package from Emby.media, and reinstalled on the QNAP.

Next, I setup Emby Server as normal, and setup a brand new (Clean) Kodi.

The issue persisted.

 

I'm starting to think the Emby Add-on is saving the credentials in the wrong place within Kodi.

 

Thanks for any assistance that can be provided.

Share this post


Link to post
Share on other sites
amkay

Hi all!

 

It's probably an issue with kodi profiles. I'll look into it but for the time being, why not install embycon? This way you can access your content on other Kodi profiles.

If I had to guess, it's probably loading the wrong settings/auth info when switching profile.

 

You are partially correct, as the add-on stores the device id of the Kodi instance globally for all users in Kodi's temp directory. As I understand it Emby only allows one user to be logged in per device, so if a second user is logged in on the same device, Emby logs out the first one on this device. At least that's what I observed on the Emby Server while trying things out in Kodi.

 

However, I solved it :)

 

Issue is here: https://github.com/MediaBrowser/plugin.video.emby/issues/142

PR is created :)

 

Have fun!

  • Like 1

Share this post


Link to post
Share on other sites
Angelblue05

@@Luke

 

Please advise what should be done here. We don't want unique ids per user, only per device, but if the user is changed, then that seems to cause the server to re-auth the user.

 

Do I need to call some sort of log out? I don't want to re-authenticate the user, I'm just not getting why the server triggers 401 error.

Edited by Angelblue05

Share this post


Link to post
Share on other sites
Luke

What exactly are you trying to do?

Share this post


Link to post
Share on other sites
amkay

Umm, just trying to fix the above described issue :)

Share this post


Link to post
Share on other sites
Luke

Yes that is correct.

Share this post


Link to post
Share on other sites
Angelblue05

Sorry Luke, the issue as described here is that users log into their main user. Then when the switch happens to load another emby user, the server triggers a 401 response when trying to authenticate the user (apparently, because of the device Id). According to one user, if they set the device id per user instead of per device, the issue goes away.

Share this post


Link to post
Share on other sites
Luke

Well no you shouldn't do that. Is there a login happening to obtain a new access token for the new user?

Share this post


Link to post
Share on other sites
Angelblue05

No, I just make a simple call to get the user information with the token and it returns 401. I'm not re-authenticating the user.

Share this post


Link to post
Share on other sites
amkay

Yes, that seems absolutely reasonable and I can understand that point of view.

On the other hand, if you set up another user on an Android device and use the Emby app there will also be two distinct devices in Emby. Same goes if you log in on the same machine with two different browsers or two different incognito windows in one browser.

Also in these scenarios an Emby user isn't logged out and subsequently logged in again when switching between users.

To put it simply, my approach was that regardless of the system (Kodi, Android, Browser) these are just multiple users on that system with respective Emby users associated to them.

Share this post


Link to post
Share on other sites
amkay

Well no you shouldn't do that. Is there a login happening to obtain a new access token for the new user?

 

As I understand it, the access token is obtained if you create a new Kodi profile and initially enter the credentials of the corresponding Emby user.

Share this post


Link to post
Share on other sites
Luke

No, I just make a simple call to get the user information with the token and it returns 401. I'm not re-authenticating the user.

 

What do you mean exactly? You can't switch users using the same access token. The new user has to login. At least if we're talking about Emby users.

Share this post


Link to post
Share on other sites
amkay

As I understand it, the access token is obtained if you create a new Kodi profile and initially enter the credentials of the corresponding Emby user.

 

And as you do that, the Emby user that is logged in in another Kodi profile is logged out and you have to enter the credentials again. If you do that, the other user is logged out. You get the point ;)

Share this post


Link to post
Share on other sites
Angelblue05

No, the appropriate token is sent. It's the same one used as when first login in the associated user. That results in 401. If a different device id is used, then no problem. Anyway, I will do more testing. I just wanted to confirm that it's one device id per device.

Edited by Angelblue05

Share this post


Link to post
Share on other sites
amkay

Perhaps the auth token is not being cleared on profile switch and the wrong token for that new user is being used.

 

Nope, checked that one. Everything is as it should be but the device id.

Share this post


Link to post
Share on other sites
Luke

Right, they can't share authentication tokens.

Share this post


Link to post
Share on other sites
Angelblue05

Nope, checked that one. Everything is as it should be but the device id.

 

But the device id should be the same across all users. Is that what you were seeing too?

 

Edit: Luke, the right auth token is being used, it's always been one token per user which is how it's always been setup. The issue is when using a new user with it's token, with the same device id, it returns a 401 response. Something is wrong.

Edited by Angelblue05

Share this post


Link to post
Share on other sites
amkay

But the device id should be the same across all users. Is that what you were seeing too?

 

Edit: Luke, the right auth token is being used. It's just the server is returning 401 for using the same device id that was just used with the previous user. At least, that's what it's looking like.

 

Exactly. As soon as the second Emby user logs in with this same device id, the Emby server removes the session of the first user on the same device. That's why all subsequent requests of that user on that device will end in a 401. As in "The access token is expired". That's what I saw when reproducing the exact same problematic request and receiving the response.

Edited by amkay
  • Like 1

Share this post


Link to post
Share on other sites
Angelblue05

@@Luke

 

This is definitely a recent issue (since early-mid August). I've just tested this and it's definitely a server issue with using the same device id. I've checked the http call and it's definitely returning 401 as soon as the new token is used with the same device id as the previous user.

 

So looks like one device id per user is now required. Unless it's a bug? I can provide my server log if need be.

Edited by Angelblue05

Share this post


Link to post
Share on other sites
horstepipe

Why would it be a problem if there were multiple device IDs for multiple users on a single device? The addon could create multiple emby_guid files for each profile, or put multiple lines of IDs in the one file.

I like the approach that a device ID can’t be shared, so wouldn’t like to see if this feature was reverted back.

Share this post


Link to post
Share on other sites
Angelblue05

It can easily be fixed, however Luke said one device id can be shared between users on the same device, so I'm just going to wait on his reply before doing anything, in case it's a bug. This used to work just fine.

Edited by Angelblue05
  • Like 1

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...