late-florist-28893
02/06/2025, 12:38 PMbrief-egg-61061
02/06/2025, 12:38 PMbrief-egg-61061
02/06/2025, 12:38 PMjsonnet local claims = { email_verified: false, } + std.extVar('claims'); { identity: { traits: { [if 'email' in claims && claims.email_verified then 'email' else null]: claims.email, first_name: claims.given_name, last_name: claims.family_name, }, }, }
3. Configure the social sign-in provider: Add the custom data mapping to your social sign-in provider configuration. You can do this either through the Ory Console or using the Ory CLI. Here's an example of how to configure it using the CLI: yaml selfservice: methods: oidc: config: providers: - id: your_provider_id provider: generic client_id: your_client_id client_secret: your_client_secret issuer_url: <https://your_provider_issuer_url> mapper_url: "base64://{YOUR_BASE64_ENCODED_JSONNET_HERE}" scope: - email - profile claims_source: id_token enabled: true
By following these steps, when a user who has previously registered with a password uses social sign-in, the automatic account linking process will occur. The custom data mapping will then update the user's profile with the information provided by the social sign-in provider, such as first name and surname. Remember to adjust the data mapping according to your specific identity schema and the claims provided by your social sign-in provider. Also, ensure that your identity schema includes the fields you want to update (e.g., first_name
and last_name
). For more detailed information on configuring social sign-in and data mapping, you can refer to the following documentation: - [Map and merge profile data](https://www.ory.sh/docs/kratos/social-signin/data-mapping) - [Generic provider configuration](https://www.ory.sh/docs/kratos/social-signin/generic)