ory / ory/network

POST /admin/identities response fields unset

Open
#347 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Shell
Stars
96
Forks
8
PR merge metrics
No merged PRs in 30d

Description

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 for credentials.identifiers, credentials.created_at and credentials.updated_at :

POST to /admin/identities payload

{   
    "credentials": {
        "password": {
            "config": {
                "password": "HelloWorld"
            }
        }
    },
    "traits": {
        "email": "test@gmail.com"
    }
}

POST to /admin/identities partial response

    "id": "0009e8ff-2665-49be-9c8a-351a42d949b8",
    "credentials": {
        "password": {
            "type": "password",
            "identifiers": null,
            "version": 0,
            "created_at": "0001-01-01T00:00:00Z",
            "updated_at": "0001-01-01T00:00:00Z"
        }
    }

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

    "id": "0009e8ff-2665-49be-9c8a-351a42d949b8",
    "credentials": {
        "password": {
            "type": "password",
            "identifiers": [],
            "version": 0,
            "created_at": "2023-09-11T17:47:59.111957Z",
            "updated_at": "2023-09-11T17:47:59.111957Z"
        }
    }

I would expect to get credentials.created_at, credentials.updated_at and credentials.identifiers filled with their actual values on the POST.

Also because of that we face failure using JAR ory-client:1.1.45 when IdentityCredentials.java tries to validate the JSON payload:

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)

Thanks

Reproducing the bug
  1. Start Kratos
  2. Create Identity with credentials using POST /admin/identities
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 too batchPatchIdentities. As the response does not contain credentials it can be parsed probably by ory-client:1.1.45

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing POST /admin/identities with password credentials, then compare its response with GET /admin/identities/{id}. Inspect the admin identity creation response and serialization path; done means identifiers, created_at, and updated_at contain their actual values and the ory-client Java model parses the response without error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kubernetes
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.