Jump to content

500 server error


hygorfragas

Recommended Posts

hygorfragas
35 minutes ago, ebr said:

Hi.  It looks like you are putting the parameters that are supposed to be in the auth header as url params.  Look closely at the Swagger doc for that call and be sure and get the x-emby-authorization header correct.

You also shouldn't have a userID on an authenticate by name call although I doubt that is causing a problem.

https://github.com/MediaBrowser/Emby/wiki/User-Authentication

thank you friend, I managed with a lot of searching for tickets on the forum and found the correct way to use the URL. even so a question came to me. if i user admin have an api key do i really need an authorization key? my calls will be diverse, something like create and delete user, view server actions and etc... just with the api key shouldn't I be able to do all this?

Link to comment
Share on other sites

TeamB

yes probably you should be able to use an API key, it is just with my endpoint, the one I created for my plugin you might not be able to use an API key.

Remember the endpoint you are trying to use is an API endpoint for a custom 3rd party plugin I wrote so I can not guarantee that it will work for anything other than what my plugin uses it for. It looks like my endpoint is not usable with API Keys so that is why I suggested using the auth approach.

My suggestion would be stick to using the official APIs of Emby and not custom 3rd party plugin endpoints.

 

Link to comment
Share on other sites

On 8/22/2021 at 8:22 PM, TeamB said:

You are correct it does not require any params

https://github.com/faush01/playback_reporting/blob/e0d169459a5c3177355e5aa924eeda67cb0ce3c3/playback_reporting/Api/UserActivityAPI.cs#L41

The API just returns a list of session info, this end point is Admin only so the user needs to be an admin

https://github.com/faush01/playback_reporting/blob/e0d169459a5c3177355e5aa924eeda67cb0ce3c3/playback_reporting/Api/UserActivityAPI.cs#L902

The 500 Error stack


	System.NullReferenceException: System.NullReferenceException: Object reference not set to an instance of an object.
	   at Emby.Server.Implementations.Library.UserManager.GetUserPolicy(User user)
	   at playback_reporting.Api.UserActivityAPI.Get(GetSessionInfo request)
	   at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req)
	   at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
	   at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
	Source: Emby.Server.Implementations
	TargetSite: MediaBrowser.Model.Users.UserPolicy GetUserPolicy(MediaBrowser.Controller.Entities.User)

 

Emby.Server.Implementations.Library.UserManager.GetUserPolicy(User user)

User is probably null

https://github.com/faush01/playback_reporting/blob/e0d169459a5c3177355e5aa924eeda67cb0ce3c3/playback_reporting/Api/UserActivityAPI.cs#L907

So

AuthorizationInfo user_info = _ac.GetAuthorizationInfo(Request);

is returning no user.

@Luke Does AuthorizationContext.GetAuthorizationInfo(Request) work with API KEYS?

 

 

Apologies for the delay. The api keys do not have a user associated with them, so that's why this happens. It it on my to do list to allow picking a user when creating one.

Link to comment
Share on other sites

TeamB
2 hours ago, Luke said:

Apologies for the delay. The api keys do not have a user associated with them, so that's why this happens. It it on my to do list to allow picking a user when creating one.

Thanks for confirming,.

@hygorfragas that is why the error occurs, if you really want to use this endpoint you will have to use an auth token you request from the auth endpojnt for an admin user.

Link to comment
Share on other sites

hygorfragas
56 minutes ago, TeamB said:

Obrigado por confirmar,.

@hygorfragas é por isso que o erro ocorre, se você realmente deseja usar este ponto de extremidade, você terá que usar um token de autenticação que você solicitou do ponto de extremidade de autenticação para um usuário administrador.

@Time B I thank you for your support, I believe that it is impossible to give this back if the original call makes it easier.at first i tried to use their api because it is more simplistic and straightforward but now i understand more about the original api and i believe i can use them. thanks

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...