Mongodb -realm authentication w/ custom JWT token public-key issue

Hi,
looks like I’m again facing issue with uploading PEM formatted keys correctly to Mongoldb-realm. This time I cannot use my trick from previous issue: ( Realm-cli, how to update secret from file

TLDR;
-cannot upload public_key on PEM format so that authentication crypto can use them

  • issue both on realm-cli and RealmUI
  • need to get option to use file on either of them or some other working solution

Detailed:
Custom JWT authentication only allows using public keys as secrets. This can either be given from UI which is basically one long line on web interface (no file upload possibility) or using realm-cli again without file upload option. Only option to give secret value is according to documentation string. I haven’t found any way to pass in this string with required newlines which are needed with PEM.
I can see on my app error log that this issue is coming from incorrectly formatted PEM file:
----- 2021-10-15 15:54:00.242537+0300 EquineIQ[22978:3358947] [Realm] [RealmLoginDatabaseModel.swift/loginToRealm(with:update:):116] Error Domain=realm::app::ServiceError Code=47 “could not find PEM formatted data in the provided public key” UserInfo={NSLocalizedDescription=could not find PEM formatted data in the provided public key, realm::app::ServiceError=AuthError} -----

As attached PEM file in case someone thinks there is an issue on that:
-----BEGIN RSA PUBLIC KEY-----
MIICCgKCAgEAtZoiUIHEMfMAHHh8zpzJaAsdeaSstGtSM31bhXFSzWpuZ3iXs6rw
pQYSFoT8xGEwNKx4InXRB+nexhvKTk8qEW3oKboJXoe+3/OcCqJMDih7qvL0sMVL
ErZVaILQzwit++TE6gtjdNdfAt2b6/Dxh+hDaNjrB2EwOIEzOZg9rsjmBpyGFU4F
hKHrUBupjz7qhpVo2oD4JO6Fstrt22U+FNVVqj4XC1kF7XDGJKq+K2FfHXcZBEol
5fz7iQjHjwhAZZu3/eVaKyyaVsAiLWBcdRAvwzayAXWrfZDcgvJo13O5q2EDo8EQ
tN5K86ApS9qmKm2SpPAsTxv//ov8MSgnZ7Cf78JvX46KwXrNq42rGPhD79oDb7Hp
hVkbqzTO9tsaDawI+pASPjeQ+XgF1Nss8IKqjlvh+J95XvNDsmlYAjeJbYwDCv/q
kvev3gIvM2jJP43vM+R2DbRrV5NANoMhJlpbvWlrgBp4fRYcQzKsvVgggLMCU4Jk
q5cORkiyUUJCvbmYfcQLjSVv1/Gvt26tJx3siI6rsN4VYKlcGAsrvKLUwdEQWVM4
71+Hv7FhEuGV6TzgZ4HXndTLt8S79oeN/kbbL4FcJKQPnod3q4IGQIPAq4YvAiwU
mUGbIgWVnTHPOUs6f27RWe17MdifVKJs5GiU6/b/6M+7sRQmNhqVE2sCAwEAAQ==
-----END RSA PUBLIC KEY-----

On my earlier case with private-key issue (I think this is exactly the same case here) I was able to take all \n’s away with script and upload that. And when using secret I just added needed \n’s when using secret. Now since usage is on authentication I don’t have capability to manipulate secret since authentication is using it directly.

sorry, pretty long but I’m bit frustrated now.
-janne