Search Unity

Question Hololens 2 Send Device Portal Commands with MRTK

Discussion in 'AR' started by PHYcore, Sep 21, 2022.

  1. PHYcore

    PHYcore

    Joined:
    Oct 20, 2016
    Posts:
    2
    I'm trying to use the MRTK Device Portal API to send commands to a local Hololens 2. I am exploring this functionality with the RESET command, eventually I'd like to use a POST command to launch an application. This is on a LAN router than I can connect to using local Photon connection.

    Code (CSharp):
    1.     public async void ResetButtonPress()
    2.     {
    3.         var headers = new Dictionary<string, string>();
    4.         authenticationReturn = Microsoft.MixedReality.Toolkit.Utilities.Rest.GetBasicAuthentication("USERNAME", "PASSWORD");
    5.         string query = "http://10.88.xxx.xx/api/control/restart";
    6.         headers.Add("Authorization", authenticationReturn);
    7.  
    8.         deviceResponse = await Microsoft.MixedReality.Toolkit.Utilities.Rest.PostAsync(query, headers);
    9.  
    10.         connected.isOn = deviceResponse.Successful;
    11.         display.text = deviceResponse.ResponseBody;
    12.     }
    13.  
    I'm receiving the error: UNITYTLS_X509VERIFY_FLAG_NOT_TRUSTED from the deviceResponse line.

    My project uses MRTK 2.7.0. I've used Fiddler to isolate the successful commands on the Web Device Portal to confirm that the authentication code I'm passing is correct. The Hololens 2 I'm using is up-to-date on software. I've tried adding additional header information based on what I've pulled from Fiddler to no avail as well.

    What am I doing wrong here?
     
  2. PHYcore

    PHYcore

    Joined:
    Oct 20, 2016
    Posts:
    2
    Is it an issue in the Authorization declaration? Does it even need to be declared in this matrix? I'm in the dark here.

    Downloading the Security Cert from the Hololens has changed the error to REST Error 403.
     
    Last edited: Sep 26, 2022
  3. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,062