Hey Trying to map metadata fields in JSONNET but ...
# talk-kratos
p
Hey Trying to map metadata fields in JSONNET but it does not work. When querying the identity they are both null. Any ideas?
Copy code
local claims = std.extVar('claims');

std.trace("claims: %s" % [claims], claims)

{
  identity: {
    traits: {
       test: "test"
    },
    metadata_public: {
        id: claims.sub,
        subscriber: true
    },
    metadata_admin: {
        tier: 1
    },
  },
}
Copy code
{
  "id": "e40ce66a-86de-4eda-b1b6-87ddc1599c1e",
  "credentials": {
    "oidc": {
      "type": "oidc",
      "identifiers": [
        "bankid:{aefcb393-366a}"
      ],
      "version": 0,
      "created_at": "2022-09-17T20:11:32.309829Z",
      "updated_at": "2022-09-17T20:11:32.309829Z"
    }
  },
  "schema_id": "default",
  "schema_url": "<http://localhost:4433/schemas/ZGVmYXVsdA>",
  "state": "active",
  "state_changed_at": "2022-09-17T20:11:32.3063348Z",
  "traits": {
    "test": "test"
  },
  "metadata_public": null,
  "metadata_admin": null,
  "created_at": "2022-09-17T20:11:32.308767Z",
  "updated_at": "2022-09-17T20:11:32.308767Z"
}
Above is the identity after it has been created. As you can see both metadata_public and admin is null.