Jump to content

API for Setting Password Does Not Work - 4.4.0.40 stable -> 4.0.5.4 beta


msmcpeake

Recommended Posts

msmcpeake

Hi, I'm on version 4.5.0.4 beta, and the last 4 versions I cannot set a new password for users via API.  I am trying to set a password for a newly created user because when a new user is created, their password is blank.   I can create the user and change user polices just fine using curl requests, utilizing examples from Swagger UI, but cannot for the life of me set a password.

 

This is my current syntax and error I receive:

curl -X POST "http://<ip>:8096/emby/Users/1a908baf86e54ab4843652e4d1fd057f/Password?api_key=<api key>" -H "accept: */*" -H "Content-Type: application/json" -d "{\"Id\":\"1a908baf86e54ab4843652e4d1fd057f\",\"CurrentPw\":\"\",\"NewPw\":\"test\",\"ResetPassword\":false}"

Object reference not set to an instance of an object.

I have nothing in my logs, and the error is very vague.  What's infuriating is once in awhile, the request goes through with no error, but the password doesn't actually set and work. I have tried removing ResetPassword, change the blank string to NULL, 0...  I am at my wits' end. Please someone assist me or explain what is wrong with this curl request.

Also, why is their an Id field in the json when the Id is already referenced in the url?

Edited by msmcpeake
Link to comment
Share on other sites

PenkethBoy

Yep thats not going to work

 

Just did a quick test and it works fine

 

for some reason you have Resetpassword as false - not sure why you thought that would work - but as true (the default from looking at swagger) works first time

Link to comment
Share on other sites

msmcpeake

Yep thats not going to work

 

Just did a quick test and it works fine

 

for some reason you have Resetpassword as false - not sure why you thought that would work - but as true (the default from looking at swagger) works first time

Did you verify the password actually set and worked after? And this was on a newly created user? This doesn't work for me. And I used the default settings as well with it as true, it didn't ever matter. Same error every time. Edited by msmcpeake
Link to comment
Share on other sites

PenkethBoy

yep - got a 204 response (which is what i would expect)  - new test user created

 

did it via swagger

 

No - i did not try and login as got a 204 response - which in emby world means success - so i assumed wrongly it was done

 

And you are correct the passwords did not take - have tried a few variations on the json posted response with no luck

 

did it manually in the UI for the user and that worked - but no clue in the logs about what it sent

 

tried easypassword as well with no positive result

 

So i guess that Swagger is wrong and needs updating

 

Only difference i am seeing to you is i dont get an error - appears to be 204 everytime - not doing it with curl just via swagger so might be the difference

 

@@Luke - can you give us some guidance on whats needed to set a password for a user

Link to comment
Share on other sites

rechigo

I've noticed this happening as well, sorry for not responding to your messages @@msmcpeake , was dealing with other projects and didn't feel like putting up with more trial and error with the Emby API

 

I just tested this on a new user

curl -X POST "http://192.168.0.69:8096/emby/Users/af0fbdc1023b40e29748ba48335cd9bb/Password?api_key=lolialmostleakeditagain"-H "accept: */*" -H "Content-Type: application/json" -d "{\"CurrentPw\":\"\",\"NewPw\":\"cuck\"}" 
and it worked perfectly, only difference being that I left out ID and ResetPassword

 

I decided to test the same command again, only difference being a different user ID. Guess what? IT DIDN'T SET THE PASSWORD! (Or so I thought) When I try to run the command again, it says invalid password. When I try to sign in, it works with the newly set password. Some things point to "Yes, a password has been set" and other things point to "No, a password hasn't been set"

 

The response to the /users/id endpoint after setting the password shows this:

3at.png

 

I'm starting to think this is a bug with the web app. Everything EXCEPT the password tab on the users page reports that "Yes, a password has in fact been set."

 

sorry if this doesnt make much sense, it was getting late and I wanted to watch a movie. if you need any clarification let me know

Edited by rechigo
Link to comment
Share on other sites

It does existing password validation against the logged in user, so currently you cannot use this api with only the api_key param. It's something we'll need to look at. 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...