Jump to content

Kodi Profiles and Emby Authentication


Shilow
 Share

Recommended Posts

MischaBoender

I'm also facing this issue since last night. Using 2 profiles in Kodi with matching accounts on Emby (access to different libraries).

Link to comment
Share on other sites

@@Luke

 

Were you able to confirm this issue or is it isolated to Emby for Kodi? Should I just set it to have a device id per profile because Emby forces re-auth when a different user uses the same device id?

Edited by Angelblue05
Link to comment
Share on other sites

 

 

Emby forces re-auth when a different user uses the same device id? 

 

Well this is correct, you can only have one user signed in at a time per device, and no, you shouldn't try to hack around.

 

To try and replicate the same scenario as what you've described, I logged into the web app with one user, then closed the browser tab and opened it back up to the login screen. Then i logged in as a second user. Everything worked fine here, there was no criss-crossing of user id's and access tokens. I think the procedure I tested pretty much follows what you've described as the workflow within the app, so this sounds to me like an issue that is isolated to the app.

  • Like 1
Link to comment
Share on other sites

@@Luke

 

I've done more testing, I've tried everything to resolve this, it just doesn't work. I'm about to give up because this is making me crazy.

 

In browser, I managed to replicate the issue. Hopefully you can too, otherwise I will just make it one device id per user instead and be done with this. I've been trying to figure this out for days now.

  1. I have two valid auth keys created via /AuthenticateByName. One per userid.
  2. In browser I call, server/emby/system/info?api_key={first access token}. Works. (in between I generate a new auth key via authenticate for user 2, using same deviceid)
  3. In browser, same tab I call, server/emby/system/info?api_key={second access token}. Works.
  4. I call server/emby/system/info?api_key={first access token} again. Doesn't work. Access token is invalid or expired.

I don't know how you tested but in the webapp, it calls logout which I don't do in Kodi. It uses the same device id across account but you have to re-auth in the webapp which I don't want that in Kodi.

 

I swear, the behavior of the server changed. Almost as if, as soon as a new token is created associated with the device id, it invalidates previous tokens or something.

Edited by Angelblue05
Link to comment
Share on other sites

I tested using the UI. You can only have one active access token per device. Once you login with the second user, the first access token is revoked. So i'm not sure how step 2 in your list could work.

  • Like 1
Link to comment
Share on other sites

Ok thanks for your response. Device ids per user is the way to go then. It's because I don't call logout. That's how it happens, I just store userid and their access token after they authenticated. So when a profile switch happens, it just uses the associated userid and token. Does that make sense?

Edited by Angelblue05
Link to comment
Share on other sites

It still doesn't to me, although i realize you will do what you need to do. But if you read my previous comments I simulated what it sounds  like you're doing and didn't have any issues with a single device id.

Link to comment
Share on other sites

Surprising.

 

The issue arises as so. First user is authenticated in their kodi profile, sync happens yaddi yadda.

Second kodi profile is created, authenticate second user using the same device id as the first user, sync happens yaddi yadda.

 

User switches back to first profile, token is invalid. Sounds to me like what you described that one active token per device id. That is what I believe changed recently and that's why I can't have one device id, because only one valid key can exists which forces all users to always have to re-authenticate.

 

I think maybe, Embycon stores the password so it AuthenticateByName every time so that's why the behavior does not exists there. It generates a new access token everytime the user is switched.

 

Anyway, just glad this is figured out.

Edited by Angelblue05
Link to comment
Share on other sites

Because I don't want to save the password... I wrote the code for emby connect in python + regular authentication following code Luke gave me, but the password is not remembered only the token.

Edited by Angelblue05
Link to comment
Share on other sites

  • 3 weeks later...

Hi,

I actually switch my Emby server from windows to Lubuntu yesterday. (same hardware, just used a new HD, restored backup from/to same version)

 

After configuring and restoring from backup, all seemed to be working fine on the web interface, playback...

Then I went to Kodi and I have the same problem as describe in this thread.

 

For all users it's asking to enter a password in Kodi (connection error, unauthorized, then emby login window popup)

I've reset local database for all users to be sure.

I'm experiencing the issue on 3 different Kodi setup that I have:

- kodi on windows 10 (manual download, not the one from windows store)

- kodi on nvidia shield (android 8.x)

- kodi on android 8.0

 

All the same behaviour for the 3 devices, the only time it's not asking to enter the password is when i reconnect to the same user.

I went to dig in the logs and found this:

Error HttpServer: Access token is invalid or expired

 

All Kodi are using : UserAgent: Emby-Kodi (3.0.34).

Server : Lubuntu 18.04.1 LTS

Emby: Version 3.5.3.0

 

I still have the other HD with the full windows/Emby installation. I can always pop in back the old drive to set back on windows. Since I only change the OS and all the other hardware/software haven't changed, I suspect it's a Ubuntu/Emby build related issue. 

I can provide logs if needed.

Edited by plasmon
Link to comment
Share on other sites

  • 2 weeks later...

Well this is correct, you can only have one user signed in at a time per device.

 

But you can still use multiple devices with the same user and the same device id, causing the problem that emby dashboard only shows one logged in device although there could be 10, all streaming different things, the admin only sees one.

Is there really no way to prevent this server side?

Link to comment
Share on other sites

If the issue still exists causing problems with multiple users (with separate profiles) in Kodi, why was the thread tagged as fixed?

I haven't tested this in a while, has the issue indeed been fixed?

Link to comment
Share on other sites

No this issue doesn't exists in beta any more because it's one device id per kodi profile now. This stops the server from revoking the token, because of the server's change (which happened a while back) that only one user can be signed in per device id.

Edited by Angelblue05
Link to comment
Share on other sites

No this issue doesn't exists in beta any more because it's one device id per kodi profile now. This stops the server from revoking the token, because of the server's change (which happened a while back) that only one user can be signed in per device id.

@@Luke

If the server is able to check whether there are two users using the same device ID and revoke the token, wouldn’t it also be able to check whether there is ONE user using the same device ID on two devices and revoke the token?

Link to comment
Share on other sites

No this issue doesn't exists in beta any more because it's one device id per kodi profile now. This stops the server from revoking the token, because of the server's change (which happened a while back) that only one user can be signed in per device id.

 

Any idea when this is being published to the end user from beta?

I'm excited to have everything working again.

 

Thanks to everyone on the project, and thanks to the folks that solves the little problems like the one I had.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...