MAX BR1 M2M - 8.0.0 build 3455 - API error

I have not been able to get the most features to work
I get an error message:
StatusCode : 200 StatusDescription : OK Content : { "stat": "fail", "code": 401, "message": "Unauthorized" }

I can check firmware but everything else is ‘Unauthorized’

Login response:
StatusCode : 200 StatusDescription : OK Content : { "stat": "ok", "response": { "permission": { "GET": 1, "POST": 1 } } }

Firmware check:StatusCode : 200 StatusDescription : OK Content : { "stat": "ok", "response": { "2": { "version": "8.0.0 build 3455", "bootable": true, "inUse": true }, "order": [ 2 ] } }

Powershell script:

add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$creds = @{
“username”=“xxx”
“password”=“xxx”
} | ConvertTo-Json
$deviceUrl = “https://xxx
Invoke-WebRequest “$deviceUrl/api/login” -Method POST -Body $creds -SessionVariable webSession -ContentType “application/json” #Working
Invoke-WebRequest “$deviceUrl/api/info.firmware” -WebSession $websession -Method GET #Working
Invoke-WebRequest “$deviceUrl/api/auth.client” -WebSession $websession -Method GET #Not working

I’m using vb.net.
I could not get the Get Client ID to work.

I use the Login api request. A ‘bauth=token value’ cookie is returned

I have a 4 hour session limit set.

If I call the logout api method within the 4 hours there must be an error in the api. It does not close the session can cancel the token

You can still make api calls referencing the token.

When the login request completes you need to retrieve the token
SessionID = GetCookie(resp.GetResponseHeader(“Set-Cookie”))
The GetCookie method retrieves the token and strips off the junk data at the end of it

I then append the local Sessionid to the api calls.
PostMethod.Headers.Add(“Cookie:” & SessionID)

I’m retrieving usage and cellular status information to display on a web page