Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.
Mango RestApi Login V3.3.1
-
Hello,
when attempting to POST the login request as outlined here, https://help.infiniteautomation.com/mango-rest-api-authentication/
I am receiving the 200OK response but I am not receiving the token or set-cookie headers in the response. We are currently on Mango V3.3.1 . I can post more info if needed was just curious if this was a known issue or if anyone had run into something similar. I am using PHP with cURL.Thanks
-
Hi matwolff, welcome to the forum!
I wonder, are you sending all the headers in the example? Are you getting a JSON response like you were successful?
I was able to curl a login and save the response headers to a /home/mango/cookie-headers file with
curl -X POST http://localhost:80/rest/v2/login --header "Accept:application/json" --header "Content-Type:application/json;charse=UTF-8" --header "X-XSRF-TOKEN:74cf354a-e871-48b6-a1c2-bebb93d00120" --header "Cookie:XSRF-TOKEN=74cf354a-e871-48b6-a1c2-bebb93d00120" --data '{"username":"admin","password":"admin"}' -D /home/mango/cookie-headers
-
@matwolff I reviewed the help article and it looks correct to me. I did however add a section on using token authentication which has been available since v3.3.0, this may interest you.
-
@phildunlap ,
Thank you for this, I was able to resolve the issue after seeing your seeing your example I was sending Set-Cookie: instead of Cookie.Thanks again!
-
@jared-wiltshire ,
thanks for this as well. This would be an awesome option but would need something longer than a 3 month expiry as we wouldn't be able to trust our end users to update this regularly. Also, I just tried to create a token to check it out and received an error with no token generated.Cannot deserialize value of type
java.util.Date
from String "2018-06-04T21:55:32.087Z": not a valid representation (error: Failed to parse Date value '2018-06-04T21:55:32.087Z': Unparseable date: "2018-06-04T21:55:32.087Z") -
@matwolff said in Mango RestApi Login V3.3.1:
thanks for this as well. This would be an awesome option but would need something longer than a 3 month expiry as we wouldn't be able to trust our end users to update this regularly.
You should be able to select a period longer than 3 months. You can also manually set the expiration date to anything you want. Just click the date input.
@matwolff said in Mango RestApi Login V3.3.1:
Also, I just tried to create a token to check it out and received an error with no token generated.
Cannot deserialize value of type java.util.Date from String "2018-06-04T21:55:32.087Z": not a valid representation (error: Failed to parse Date value '2018-06-04T21:55:32.087Z': Unparseable date: "2018-06-04T21:55:32.087Z")I think you must have
rest.customDateInputFormat
set to something in your${MA_HOME}/overrides/properties/env.properties
file. Delete that line and alsorest.customDateOutputFormat
. They now have defaults for parsing/formatting dates as ISO 8601.