Mattermost, Inc.

Mattermost API "http/1.1 302 moved temporarily"

Hello, I have success fully mapped by domain to url server on google cloud and everything is working correctly on the desktop app. However when I try and log in through the API call I get http/1.1 302 moved temporarily rather than http/1.1 200 OK per the documentation. Anyone can suggest what the issue is?

curl -i -d “{“login_id”:“”,“password”:“thisisabadpassword”}”

If you use quotes like that, you should be seeing an HTTP 400 bad request, because the quotes in your -d argument don’t make any sense. I was able to successfully log in to my dev server like this:

musikpolice$ curl -i -d '{"login_id":"", "password":"thisisagoodpassword"}' http://localhost:8065/api/v4/users/login
HTTP/1.1 200 OK
Content-Type: application/json
Set-Cookie: MMAUTHTOKEN=zwqoj4kepintipaafyj3kctzma; Path=/; Expires=Fri, 12 Jan 2018 13:21:57 GMT; Max-Age=2592000; HttpOnly
Set-Cookie: MMUSERID=fjfinz176jf9zyxfq7w5btsikr; Path=/; Expires=Fri, 12 Jan 2018 13:21:57 GMT; Max-Age=2592000
Token: zwqoj4kepintipaafyj3kctzma
X-Request-Id: yh8oy1z4uj8mdn5js1g333c31h
Date: Wed, 13 Dec 2017 13:21:57 GMT
Content-Length: 535

Similarly, if I specify a bad password, I get an HTTP 401 back:

musikpolice$ curl -i -d '{"login_id":"", "password":"this isabadpassword"}' http://localhost:8065/api/v4/users/login
HTTP/1.1 401 Unauthorized
Content-Type: application/json
X-Request-Id: hm48ss6gkpg1zdn8cc3xu9s4gy
Date: Wed, 13 Dec 2017 13:23:33 GMT
Content-Length: 222

Can you confirm that you’re using the correct cURL syntax?