Jump to content

Access token is invalid of expired on Delete using my API_Key


Brazer

Recommended Posts

Brazer

Hi all

I am trying to delete a collection via the API using my generated API key. I am getting a 401. Why?

2024-04-23 01:21:38.435 Info Server: http/1.1 DELETE https://host1:8920/emby/Items/Delete=3748005&api_key=_secret_. UserAgent: python-requests/2.31.0
2024-04-23 01:21:38.450 Warn Server: AUTH-ERROR: 188.74.100.63 - Access token is invalid or expired.
2024-04-23 01:21:38.450 Error Server: Access token is invalid or expired.
2024-04-23 01:21:38.450 Info Server: http/1.1 Response 401 to host4. Time: 15ms. DELETE https://host1:8920/emby/Items/Delete=3748005&api_key=_secret_
 

Link to comment
Share on other sites

Hi, what version of the server? I just tested deleting a collection in the web app and it worked just fine.

Link to comment
Share on other sites

Brazer

@LukeVersion 4.9.0.13 beta

All the other calls work. It is just the delete. 

Link to comment
Share on other sites

OK please attach the emby server log from when that happened. Thanks.

Link to comment
Share on other sites

Forgive me for hijacking the thread, as I have also been trying to get the DELETE call to work (v4.8.5).

It seems to execute successfully from Swagger and produces the following URL:

https://emby.FQDN.redacted/emby/Items/405542?api_key=[redacted]

However, when I try to perform it locally, substituting the API key with the one I have produced in the Dashboard, I get the following error out of the server, complaining that the "user" parameter cannot be null. Where am I going wrong? I have tried adding in the ?userId parameter, as well as just ?user but it doesn't resolve the problem.

2024-04-30 22:55:31.522 Info Server: http/1.1 DELETE http://‌‍‍emby.FQDN.redacted/Items/405688?api_key=‌e16bfdd4c29b4ba8bd54f334f4721afd‌. UserAgent: python-requests/2.31.0
2024-04-30 22:55:31.523 Debug SqliteItemRepository: GetitemById Episode 405688 /mnt/emby/TV/[filename]
2024-04-30 22:55:31.523 Error Server: Error processing request
        *** Error Report ***
        Version: 4.8.5.0
        Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb
        Operating system: Linux version 5.15.0-101-generic (buildd@lcy02-amd64-032) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #111-Ubun
        Framework: .NET 6.0.25
        OS/Process: x64/x64
        Runtime: opt/emby-server/system/System.Private.CoreLib.dll
        Processor count: 2
        Data path: /var/lib/emby
        Application path: /opt/emby-server/system
        System.ArgumentNullException: System.ArgumentNullException: Value cannot be null. (Parameter 'user')
           at MediaBrowser.Controller.Entities.BaseItem.GetShareLevel(User user)
           at Emby.Api.Library.LibraryService.Any(DeleteItems request)
           at Emby.Api.Library.LibraryService.Any(DeleteItem request)
           at Emby.Server.Implementations.Services.ServiceController.<>c__DisplayClass8_0.<VoidActionDelegate>b__0(Object service, Object request)
           at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req, Type serviceType)
           at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost httpHost, IServerApplicationHost appHost, IRequest httpReq, IResponse httpRes, IStreamHelper streamHelper, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
           at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
        Source: MediaBrowser.Controller
        TargetSite: MediaBrowser.Model.Dto.UserItemShareLevel GetShareLevel(MediaBrowser.Controller.Entities.User)
 

Link to comment
Share on other sites

pünktchen
8 hours ago, artstar said:

2024-04-30 22:55:31.522 Info Server: http/1.1 DELETE http://‌‍‍emby.FQDN.redacted/Items/405688?api_key=‌e16bfdd4c29b4ba8bd54f334f4721afd‌. UserAgent: python-requests/2.31.0
2024-04-30 22:55:31.523 Debug SqliteItemRepository: GetitemById Episode 405688 /mnt/emby/TV/[filename]
2024-04-30 22:55:31.523 Error Server: Error processing request

Your python request is missing "emby" between your FQDN and Items.

Link to comment
Share on other sites

1 hour ago, pünktchen said:

Your python request is missing "emby" between your FQDN and Items.

My fault for not mentioning that I tried it both with and without 'emby' in it. Both yield the same result.

Link to comment
Share on other sites

pünktchen
3 hours ago, artstar said:

My fault for not mentioning that I tried it both with and without 'emby' in it. Both yield the same result.

You need "emby", but probably also the user end point that is mentioned in the other thread that you've posted in.

Link to comment
Share on other sites

8 hours ago, pünktchen said:

You need "emby", but probably also the user end point that is mentioned in the other thread that you've posted in.

Appreciate it. Trying to figure out what that user endpoint is, given I copy and paste the cURL command that's created by Swagger. Swagger executes the API call just fine but copy and paste of the cURL command (for execution locally) fails in exactly the same way as described. Anyway, I'll cease with the rude double-posting. I didn't realise amateurgod had already been discussing this until after I posted in this thread. Seems more appropriate to continue the conversation there.

Link to comment
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...