Hello everyone! I was trying to create a user with REST API, but i always got the error: you must be logged in to do this. I read some related issues, but they are not so useful for me. I will appreciate it, if you have any idea. Thank you very much!
1. create an admin (on the Web Interface):
username=huimin
password=12
2. Login with REST API
_curl http://localhost:3000/api/v1/login
-d "username=huimin&password=123"_
3. Create a new user with REST API (The Token and UserId are available after STEP2)
_curl -H "X-Auth-Token: f3N9AOig5FKgr_L4Gnrc_QE_yheUk6lyRKaV2eRlxFp"
-H "X-User-Id: 7HZbmGjYLkkSW7nFC"
-H "Content-type:application/json"
http://localhost:3000/api/v1/users.create
-d '{"name": "A", "email": "[email protected]", "password": "123", "username":"A" }'_
A new user A could be created successfully
_{"status":"error","message":"You must be logged in to do this."}_
Thanks for any idea!
Hello @huiminzeng , I did the tests here following the step by step provided by you and I was not able to reproduce the error, in all cases they worked. Could you show the result returned from the /login please, so we can recheck it?
Hello @MarcosSpessatto . I have done a lot of tests recently. And i can't reproduce this error either. Currently, it seems that everything works really fine! Thus, I think this issue should be closed.
Thank you very much.
Have started receiving this randomly.
"rocketChatServer": {
"status": "error",
"message": "You must be logged in to do this."
}
Most helpful comment
Have started receiving this randomly.