Question on LXD Token Auth

Okay, I have been able to reproduce why I was initially getting the invalid certificate type, this is because I did not include the client type, it should not be like so:

{
  "certificate": "X509 PEM certificate",
  "name": "castiana",
  "password": "blah",
}

but like so:

{
  "certificate": "X509 PEM certificate",
  "name": "castiana",
  "password": "blah",
  "type": "client"
}

The "type": "client" should be included, now, the next error is, the illegal base64 data at input byte 0

Edit:

Fixed, it turns out, the pem certificate needs to be commented out, so, here is what I did:

$pemCert =  trim(str_replace([
                "-----BEGIN CERTIFICATE-----",
                "-----END CERTIFICATE-----"
            ], null, $pemCert]));

and now, I can add and update a cert

1 Like