Rocket.chat: "you must be logged in to do this" while creating a user with REST API

Created on 17 May 2018  路  3Comments  路  Source: RocketChat/Rocket.Chat

Description:

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!

Server Setup Information:

  • Version of Rocket.Chat Server: 0.64.1
  • Operating System: Ubuntu 16.04
  • Deployment Method(snap/docker/tar/etc): docker
  • Number of Running Instances: 1
  • Node Version: v8.11.1
  • mongoDB Version: 3.2

Steps to Reproduce:

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" }'_

Expected behavior:

A new user A could be created successfully

Actual behavior:

_{"status":"error","message":"You must be logged in to do this."}_

Thanks for any idea!

api rest waiting response

Most helpful comment

Have started receiving this randomly.

"rocketChatServer": {
            "status": "error",
            "message": "You must be logged in to do this."
        }

All 3 comments

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."
        }
Was this page helpful?
0 / 5 - 0 ratings

Related issues

danpospisil picture danpospisil  路  3Comments

karlprieb picture karlprieb  路  3Comments

djeber picture djeber  路  3Comments

brendanheywood picture brendanheywood  路  3Comments

neha1deshmukh picture neha1deshmukh  路  3Comments