Can't use metadata fields from multiple social sign-in providers
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 96
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
Preflight checklist
- I could not find a solution in the existing issues, docs, nor discussions.
- I agree to follow this project's Code of Conduct.
- I have read and am following this repository's Contribution Guidelines.
- This issue affects my Ory Cloud project.
- I have joined the Ory Community Slack.
- I am signed up to the Ory Security Patch Newsletter.
Describe the bug
I'm trying to add different metadata_admin field mappings from different social sign-in providers. Only the fields provided by the first provider that is linked (by the end-user) persist. Is this expected behaviour, and, if so, is there a workaround?
Is there a way to populate fields from other providers, alongside the first one that is linked?
Reproducing the bug
- User links Github as social login in the self-service UI
- Then links Discord.
admin/identities/{id}endpoint returns only metadata fields provided by Github for the given user.
If first two steps are reversed, only Discord fields persist.
Relevant log output
{
"id": "e4477736-7129-487c-a737-984a3552b8ea",
"credentials": {
"oidc": {
"type": "oidc",
"identifiers": [
"discord:*********",
"github:******"
],
"version": 0,
"created_at": "2022-09-28T14:28:09.934526Z",
"updated_at": "2022-09-28T14:28:50.394822Z"
},
"password": {
...
},
"webauthn": {
...
}
},
"schema_id": "f17ab650e6caa0b4210e08c9b057fcbf9bc30f3ed270dea04e3048ada6295f746141bf1ce1ed60b633c874db2ea0e65a1524575a00fb579ef0c3f156587ffbb3",
"schema_url": "https://****.projects.oryapis.com/schemas/ZjE3YWI2NTBlNmNhYTBiNDIxMGUwOGM5YjA1N2ZjYmY5YmMzMGYzZWQyNzBkZWEwNGUzMDQ4YWRhNjI5NWY3NDYxNDFiZjFjZTFlZDYwYjYzM2M4NzRkYjJlYTBlNjVhMTUyNDU3NWEwMGZiNTc5ZWYwYzNmMTU2NTg3ZmZiYjM",
"state": "active",
"state_changed_at": "2022-09-28T14:28:09.813677Z",
"traits": {
...
},
"verifiable_addresses": [
{
...
}
],
"recovery_addresses": [
...
],
"metadata_public": null,
"metadata_admin": {
"github_avatar_url": "https://avatars.githubusercontent.com/u/****?v=4",
"github_profile_url": "https://github.com/****"
},
"created_at": "2022-09-28T14:28:09.837233Z",
"updated_at": "2022-09-28T14:28:09.837233Z"
}
Relevant configuration
{
"$id": "https://schemas.ory.sh/presets/kratos/identity.email.schema.json",
"title": "Person",
"type": "object",
"properties": {
"traits": {
...
},
"metadata_admin": {
"type": "object",
"properties": {
"discord_name": {
"type": "string"
},
"github_profile_url": {
"type": "string"
},
"github_avatar_url": {
"type": "string"
}
}
}
}
}
Version
Latest
On which operating system are you observing this issue?
Ory Cloud
In which environment are you deploying?
Ory Cloud
Additional Context
Github jsonnet mapping
local claims = {
email_verified: false,
} + std.extVar('claims');
{
identity: {
traits: {
[if 'email' in claims && claims.email_verified then 'email' else null]: claims.email,
},
metadata_admin: {
github_profile_url: claims.profile,
github_avatar_url: claims.picture
},
},
}
Discord jsonnet mapping
local claims = {
email_verified: false,
} + std.extVar('claims');
{
identity: {
traits: {
[if 'email' in claims && claims.email_verified then 'email' else null]: claims.email,
},
metadata_admin: {
discord_name: claims.name
},
},
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the GitHub-then-Discord and Discord-then-GitHub linking sequences, then inspect the admin/identities/{id} response and the two provider JSONNet mappings shown in the issue. Done means metadata_admin retains the fields supplied by both linked providers, or the expected behavior and a workaround are documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100