Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/kratos/social-signin/90_data-mapping.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,14 @@ Example: update the user's groups from the provider while preserving an existing
local claims = std.extVar('claims');
local identity = std.extVar('identity');

// Keep the display name if the user has set one, otherwise use the one from the provider (if any).
local displayName = std.get(identity.traits, "display_name", std.get(claims, "display_name", ""));

{
identity: {
traits: {
email: claims.email,
// Keep the display name if the user has set one.
[if "display_name" in identity.traits && identity.traits.display_name != "" then "display_name"]:
identity.traits.display_name,
[if displayName != "" then "display_name" else null]: displayName,
// Always update groups from the provider.
[if "groups" in claims.raw_claims then "groups" else null]:
claims.raw_claims.groups,
Expand Down
Loading