abundant-baker-49319
12/11/2024, 2:20 PMbrief-egg-61061
12/11/2024, 2:20 PMbrief-egg-61061
12/11/2024, 2:21 PMjsonnet local claims = { phone_number_verified: false, } + std.extVar('claims'); { identity: { traits: { // Only include the phone number if it exists and is verified [if 'phone_number' in claims && claims.phone_number_verified then 'phone_number' else null]: claims.phone_number, }, }, }
This approach is similar to how emails are handled, as shown in the [Ory documentation on emails and phone numbers](https://www.ory.sh/docs/kratos/social-signin/data-mapping#emails-and-phone-numbers). However, it's crucial to note that: 1. Not all providers return phone numbers by default. 2. The availability and naming of phone number claims may vary between providers. 3. You need to ensure that the provider is configured to return phone number information if available. For Google specifically, you might need to request additional scopes to access the phone number. The [Google configuration example](https://www.ory.sh/docs/kratos/social-signin/google#additional-configuration) doesn't mention phone numbers explicitly, so you may need to consult Google's OAuth documentation for the correct scope. For LinkedIn and Apple, the provided knowledge sources don't contain specific information about phone number claims. Remember to always verify the phone number before using it, just as you would with an email address. This helps prevent potential security vulnerabilities. Lastly, don't forget to encode your Jsonnet snippet with Base64 or host it under a URL accessible to Ory Network when adding it to your configuration, as mentioned in the [LinkedIn configuration guide](https://www.ory.sh/docs/kratos/social-signin/linkedin). If you need more specific information about phone number claims for these providers, you may need to consult their respective OAuth documentation or contact Ory support for more detailed guidance.