ory / ory/sdk

npm @ory/client - Objects being duplicated when calling OAuth2Api.acceptOAuth2ConsentRequest()

Open
#321 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
178
Forks
96
Avg merge
6d 23h
Merged PRs (30d)
3

Description

Preflight checklist
Ory Network Project

No response

Describe the bug

When assigning an object (such as name) to id_token and calling OAuth2Api.acceptOAuth2ConsentRequest(), the resulting localStorage value is duplicated.

Reproducing the bug
  1. Self host Ory Kratos
  2. Self host Ory Hydra
  3. Attach object to id_token
  4. Call OAuth2Api.acceptOAuth2ConsentRequest()
  5. Inspect localStorage in the browser
Relevant log output
{  
    "profile": {
        "name": [
            {
                "first": "John",
                "last": "Doe"
            },
            {
                "first": "John",
                "last": "Doe"
            }
        ],
    },
}
Relevant configuration
{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Person",
    "type": "object",
    "properties": {
      "traits": {
        "type": "object",
        "properties": {
          "name":{
            "type":"object",
            "properties": {
              "first": {
                "type":"string",
                "title":"Your first name",
                "minLength": 1,
                "maxLength": 32
              },
              "last": {
                "type":"string",
                "title":"Your last name",
                "minLength": 1,
                "maxLength": 32
              }
            },
            "required": ["first","last"]
          }
        },
        "required": ["name"]
      }
    },
    "additionalProperties": false
  }
Version

1.5.2

On which operating system are you observing this issue?

Windows

In which environment are you deploying?

Binary

Additional Context

No response

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 at OAuth2Api.acceptOAuth2ConsentRequest() in the npm @ory/client SDK and reproduce the call with an object-valued id_token using the configuration shown. Trace where the consent request is serialized and verify the localStorage result; done means the object appears once rather than being duplicated.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
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.