Jump to content

Script to create a user no longer working?


AuroraServices

Recommended Posts

AuroraServices

Hello, so I've had this script kicking around for awhile now and it actually did work at one point.

however today when I decided to use it again of course somethings failing. So I jumped into swagger to double check the api commands and for some reason /connect/invite no longer works? ( TypeError: Failed to fetch ) so, couple question 1) what happend to the command and 2

anyone have a quick fix? 

 

I'm including the script below as I'm more then willing to share all I ask is if you get it to work please post any changes so we can all benefit. Script is a whmcs module that pulls the required info from the database and passes it along to emby via the api.

 

 

 

emby.zip

Link to comment
Share on other sites

AuroraServices

actually what I really need to know is, does connect/invite still work or has it been replaced with a new command?

Link to comment
Share on other sites

AuroraServices

no usually 1 at a time

I can get a response with other commands just not the connect/invite

Edited by AuroraServices
Link to comment
Share on other sites

AuroraServices

managed to get it to spit out some info finally

Request:

Array
(
    [username] => 
    [pw] => 
    [password] => da39a3ee5e6b4b0d3255bfef95601890afd80709
    [passwordMd5] => d41d8cd98f00b204e9800998ecf8427e
    [url] => /emby/Users/AuthenticateByName
    [headers] => Array
        (
            [type] => Content-Type: application/json
            [auth] => X-Emby-Authorization: MediaBrowser Client=Android, Device=Samsung Galaxy SIII, DeviceId=xxx, Version=1.0.0.0
        )

)


Response:

Array
(
    [status] => error
    [message] => HTTPCODE: 0. Error: 
    [response] => 
)


Request:

Array
(
    [name] => edited:taken from whmcs database custom field entry
    [url] => /emby/Connect/Invite
    [headers] => Array
        (
            [type] => Content-Type: application/json
            [auth] => X-Emby-Authorization: MediaBrowser Client=Android, Device=Samsung Galaxy SIII, DeviceId=xxx, Version=1.0.0.0
        )

)

Response:

Array
(
    [status] => error
    [message] => HTTPCODE: 0. Error: 
    [response] => 
Link to comment
Share on other sites

Your posting to your emby server, therefore these requests should show up in the emby server log. can you find that log file? thanks.

Link to comment
Share on other sites

AuroraServices

so i actually tried a direct command, 

curl -X POST "http://edited:8096/emby/Users/New?api_key=edited" -H  "accept: application/json" -H  "Content-Type: application/json" -d "{\"Name\":\"bobobobob\"}"

and it does work but still nothing in the logs as well, if i make it fail still nothing in the logs?

 

i even turned on debug mode, logs are working as i've got 500 reports of streaming etc working but nothing relating to the api at all?

Link to comment
Share on other sites

AuroraServices

that's what I'm saying, nothing is being logged.

 

I did a video to show you what is happening

 

I cleared the logs so if anything was logged we'd see it.

Edited by AuroraServices
Link to comment
Share on other sites

You're making it hard for us to help you because we keep asking for the emby server log but still haven't gotten one. Thanks.

Link to comment
Share on other sites

AuroraServices

ummm no I've not tried to be difficult, however I even sent you a video showing the /users/new command working but not log being made at all. it's not that I don't want to send the log, there is NO LOG FOR ME TO SEND. I can send you my daily normal log but it has nothing relating to the api in it at all.

 

Again if there is something I need to do to get the api log let me know and it will be done.

Link to comment
Share on other sites

Is it possible that the app doesn't have permission to create the log file?

 

If you expand the debug console on the dashboard page that should show the log, are there errors there?

Link to comment
Share on other sites

AuroraServices

where do I find this? I can't find a debug tab/option on the dashboard. I have turned debug logging off and on it the logs tab and nothing shows there still.

Also regular logs are being written.Attached the emby log. I ran the command 4 times while this log was active.

 

 

 

 

Log.txt

Edited by AuroraServices
Link to comment
Share on other sites

AuroraServices

so couple of things

 

1) yes the command Create/Invite has been removed apparently as it doesn't work at all.

2) the api logging is very broken as emby will process the /Users/New command but will not log any response ( doesn't matter if it works or fails no response is logged at all in the emby.txt log. ) This is the problem I've been trying to get a response on since I opened this thread but all I'm getting is " please supply the log" if the api is broken and not logging data how can I supply the log?

 

all I want to do is take a username from the database and send it to emby, why is it so hard to get a straight answer?

Link to comment
Share on other sites

You submitted one here and as far as i can tell it worked just fine, no errors:

2018-08-18 07:22:49.291 Info HttpServer: HTTP POST http://104.218.18.106:8096/emby/Connect/Invite. UserAgent: Mozilla/5.0 (Linux; Android 6.0; HTC Desire 10 pro Build/MRA58K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.91 Mobile Safari/537.36

Did that user accept their invitation?

Link to comment
Share on other sites

AuroraServices

invite was never sent, actually, I honestly searched the log for connect/invite and now feel like a knob. 

 

so new question, TypeError: Failed to fetch?? this is what comes up on the api page when i hit execute in the try it out section, if i manually run the curl command it returns value can not be null, I can run most of the other commands and it is authorized and connecting.

 

lost on what the error means other then page can not be found.

Link to comment
Share on other sites

on the api page i'm guessing a param is missing. it should say what the response code is. that, along with the response body will indicate what the problem is.

Link to comment
Share on other sites

AuroraServices

digging deeper it seems the authentication is failing maybe?

2018-08-22 23:28:21.586 Error HttpServer: Error processing request
	*** Error Report ***
	Version: 3.5.2.0
	Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb
	Operating system: Unix 4.4.0.133
	64-Bit OS: True
	64-Bit Process: True
	User Interactive: True
	Processor count: 32
	Program data path: /var/lib/emby
	Application directory: /opt/emby-server/system
	System.ArgumentNullException: Value cannot be null.
	Parameter name: id
	   at Emby.Server.Implementations.Library.UserManager.GetUserById(Guid id)
	   at Emby.Server.Connect.ConnectManager.GetUser(Guid id)
	   at Emby.Server.Connect.ConnectManager.InviteUserInternal(ConnectAuthorizationRequest request)
	   at Emby.Server.Connect.ConnectManager.InviteUser(ConnectAuthorizationRequest request)
	   at Emby.Server.Connect.Api.ConnectService.Post(CreateConnectInvite request)
	   at Emby.Server.Implementations.Services.ServiceExecGeneral.GetTaskResult(Task task)
	   at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, ILogger logger, String operationName, CancellationToken cancellationToken)
	   at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IHttpRequest httpReq, String urlString, String host, String localPath, CancellationToken cancellationToken)
	System.ArgumentNullException
	   at Emby.Server.Implementations.Library.UserManager.GetUserById(Guid id)
	   at Emby.Server.Connect.ConnectManager.GetUser(Guid id)
	   at Emby.Server.Connect.ConnectManager.InviteUserInternal(ConnectAuthorizationRequest request)
	   at Emby.Server.Connect.ConnectManager.InviteUser(ConnectAuthorizationRequest request)
	   at Emby.Server.Connect.Api.ConnectService.Post(CreateConnectInvite request)
	   at Emby.Server.Implementations.Services.ServiceExecGeneral.GetTaskResult(Task task)
	   at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, ILogger logger, String operationName, CancellationToken cancellationToken)
	   at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IHttpRequest httpReq, String urlString, String host, String localPath, CancellationToken cancellationToken)
Link to comment
Share on other sites

AuroraServices

yeah I tried adding the variable id : 85574578547u8fh ( not real id but i did use a actual admin id in command ) still something missing..the search continues!

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