• Recent
    • Tags
    • Popular
    • Register
    • Login

    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.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Mango RestApi Login V3.3.1

    User help
    mangoapi rest api login
    3
    6
    1.8k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      matwolff
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • phildunlapP
        phildunlap
        last edited by phildunlap

        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

        M 1 Reply Last reply Reply Quote 0
        • Jared WiltshireJ
          Jared Wiltshire
          last edited by Jared Wiltshire

          @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.

          Developer at Radix IoT

          M 1 Reply Last reply Reply Quote 0
          • M
            matwolff @phildunlap
            last edited by

            @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!

            1 Reply Last reply Reply Quote 0
            • M
              matwolff @Jared Wiltshire
              last edited by

              @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")

              Jared WiltshireJ 1 Reply Last reply Reply Quote 0
              • Jared WiltshireJ
                Jared Wiltshire @matwolff
                last edited by

                @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.

                0_1527004386475_e03f2793-cd8b-48e9-9edd-ea86c876d30d-image.png

                @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 also rest.customDateOutputFormat. They now have defaults for parsing/formatting dates as ISO 8601.

                Developer at Radix IoT

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post