Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata and trait not update on link with other google account via oidc #3816

Open
3 of 5 tasks
HoangViet144 opened this issue Mar 11, 2024 · 1 comment
Open
3 of 5 tasks
Labels
bug Something is not working.

Comments

@HoangViet144
Copy link

HoangViet144 commented Mar 11, 2024

Preflight checklist

Ory Network Project

No response

Describe the bug

When linking with other google account, the trait and metadata are not updated with information from new google account.

My kratos supports both password and oidc.
I register an account using oidc with email A.
Then I set a password for my account
After that, I unlink and link with other email B. But the trait and metadata are not updated with information from email B. In the setting hook, I dont have any info from new link account to update manually using hook

"identity.default.schema.json": |
  {
    "$id": "https://schemas.ory.sh/presets/kratos/identity.email.schema.json",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Person",
    "type": "object",
    "properties": {
      "traits": {
        "type": "object",
        "properties": {
          "first_name": {
            "type": "string",
            "title": "First name",
            "maxLength": 256
          },
          "last_name": {
            "type": "string",
            "title": "Last name",
            "maxLength": 256
          },
          "email": {
            "type": "string",
            "format": "email",
            "title": "E-Mail",
            "maxLength": 256,
            "ory.sh/kratos": {
              "credentials": {
                "password": {
                  "identifier": true
                },
                "webauthn": {
                  "identifier": true
                },
                "totp": {
                  "account_name": true
                },
                "code": {
                  "identifier": true,
                  "via": "email"
                }
              },
              "recovery": {
                "via": "email"
              },
              "verification": {
                "via": "email"
              }
            }
          }
        },
        "required": [
          "first_name",
          "last_name",
          "email"
        ],
        "additionalProperties": false
      },
      "metadata_public": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          }
        }
      }
    }
  }
"oidc.google.jsonnet": |
  local claims = {
    email_verified: false,
  } + std.extVar('claims');

  {
    identity: {
      traits: {
        first_name: claims.given_name,
        last_name: claims.family_name,
        [if 'email' in claims && claims.email_verified then 'email' else null]: claims.email,
      },
      "metadata_public": {
        [if 'email' in claims && claims.email_verified then 'email' else null]: claims.email,
      }
    }
  }

Reproducing the bug

My kratos supports both password and oidc.
I register an account using oidc with email A.
Then I set a password for my account
After that, I unlink and link with other email B. But the trait and metadata are not updated with information from email B. In the setting hook, I dont have any info from new link account to update manually using hook

Relevant log output

No response

Relevant configuration

No response

Version

v1.1.0

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Kubernetes with Helm

Additional Context

No response

@HoangViet144 HoangViet144 added the bug Something is not working. label Mar 11, 2024
@robinknaapen
Copy link

Maybe related to: #2898

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

No branches or pull requests

2 participants