Open Matthias64 opened 1 year ago
Can you please check this on the latest master branch (you can use make docker
) and SDK?
Also can you please include a fully reproducible example (preferably against an Ory Network project and with some CURL commands). Thanks!
Hello,
I reproduced it on an Ory Network Project as follows :
{
"$id": "https://schemas.ory.sh/presets/kratos/identity.email.schema.json",
"title": "Person",
"type": "object",
"properties": {
"traits": {
"type": "object",
"properties": {
"email": {
"type": "string",
"format": "email",
"title": "E-Mail",
"ory.sh/kratos": {
"credentials": {
"password": {}
}
},
"maxLength": 320
}
},
"required": [
"email"
],
"additionalProperties": false
}
}
}
curl -X POST -H "Authorization: Bearer API_KEY" -H 'Content-Type: application/json' -d '{ ─╯
"credentials": {
"password": {
"config": {
"password": "HelloWorld"
}
}
},
"traits": {
"email": "tes21abc@gmail.com"
}
}' https://busy-borg-n8ih2ob1dd.projects.oryapis.com/admin/identities | jq
In the output credentials created_at
and updated_at
are set to "0001-01-01T00:00:00Z" and identifiers
is set to null
{
"id": "3b927c1d-bd7e-492e-a574-9b380c0e7041",
"credentials": {
"password": {
"type": "password",
"identifiers": null,
"version": 0,
"created_at": "0001-01-01T00:00:00Z",
"updated_at": "0001-01-01T00:00:00Z"
}
},
"schema_id": "b20d3e662c35fdeb646de7658ff490347e8b01327ceba95150362c8556323b6ce550b347cee1e585f5efe15669474be5736b8bc6c8f77f36caa821d05b0caaf4",
"schema_url": "https://busy-borg-n8ih2ob1dd.projects.oryapis.com/schemas/YjIwZDNlNjYyYzM1ZmRlYjY0NmRlNzY1OGZmNDkwMzQ3ZThiMDEzMjdjZWJhOTUxNTAzNjJjODU1NjMyM2I2Y2U1NTBiMzQ3Y2VlMWU1ODVmNWVmZTE1NjY5NDc0YmU1NzM2YjhiYzZjOGY3N2YzNmNhYTgyMWQwNWIwY2FhZjQ",
"state": "active",
"state_changed_at": "2023-09-26T07:51:32.320016706Z",
"traits": {
"email": "tes21abc@gmail.com"
},
"metadata_public": null,
"created_at": "2023-09-26T07:51:32.323942Z",
"updated_at": "2023-09-26T07:51:32.323942Z",
"organization_id": null
}
And this causes a validation error on the ory-client
JAR
java.lang.IllegalArgumentException: Expected the field `identifiers` to be an array in the JSON string but got `null`
at sh.ory.model.IdentityCredentials.validateJsonObject(IdentityCredentials.java:357)
at sh.ory.model.IdentityCredentials$CustomTypeAdapterFactory$1.read(IdentityCredentials.java:399)
at sh.ory.model.IdentityCredentials$CustomTypeAdapterFactory$1.read(IdentityCredentials.java:372)
Thank you for the reproduction!
Preflight checklist
Describe the bug
Hello,
We are using
oryd/kratos:v1.0.0
. When we create an identity with credentials, the response contains wrong values forcredentials.identifiers
,credentials.created_at
andcredentials.updated_at
:POST to /admin/identities payload
POST to /admin/identities partial response
When we retrieve the same identity right after, the payload is correct with all the fields set GET to /admin/identities/0009e8ff-2665-49be-9c8a-351a42d949b8 partial response
I would expect to get
credentials.created_at
,credentials.updated_at
andcredentials.identifiers
filled with their actual values on the POST.Also because of that we face failure using JAR
ory-client:1.1.45
whenIdentityCredentials.java
tries to validate the JSON payload:Thanks
Reproducing the bug
Relevant log output
No response
Relevant configuration
No response
Version
oryd/kratos:v1.0.0
On which operating system are you observing this issue?
Linux
In which environment are you deploying?
Kubernetes
Additional Context
As a workaroound, in case that can help others, I have replaced the
createIdentity
by a call toobatchPatchIdentities
. As the response does not containcredentials
it can be parsed probably byory-client:1.1.45