lively-scientist-17848
10/28/2024, 2:09 PMbrief-egg-61061
10/28/2024, 2:09 PMbrief-egg-61061
10/28/2024, 2:09 PMfullName
property of the AppleAuthenticationCredential
object. 2. In the example provided for native apps using the Apple SDK, you can see how the name is accessed and mapped: typescript return { id_token: credential.identityToken || "", id_token_nonce: digest, traits: { name: { first: credential.fullName?.givenName || "given name", last: credential.fullName?.familyName || "last name", }, }, }
[Using the Apple SDK on native apps](https://www.ory.sh/docs/kratos/social-signin/apple#using-the-apple-sdk-on-native-apps) 3. For web browser flows, you'll need to map the name in your Jsonnet data mapper. However, it's important to note that Apple doesn't provide the name information in the standard claims. Instead, you'll need to handle it separately when the user first signs in, as Apple only provides the name once. 4. In your Jsonnet data mapper, you can access the claims using std.extVar('claims')
. However, for Apple sign-in, you might not find the name directly in these claims. 5. If you've stored the name during the initial sign-in, you could potentially access it from your identity traits or metadata, depending on how you've set up your data structure. Remember that Apple's approach to providing user information is more privacy-focused, so you might need to adjust your strategy for handling user names compared to other social sign-in providers.lively-scientist-17848
10/28/2024, 2:15 PMbrief-egg-61061
10/28/2024, 2:15 PMbrief-egg-61061
10/28/2024, 2:16 PMstd.extVar('claims')
object in your Jsonnet code. This object contains all the values returned by the social sign-in provider. Here's how you can explore and use these claims: 1. Access the claims object: jsonnet local claims = std.extVar('claims');
2. To see all available claims, you can use the raw_claims
property, which contains all claims that are not part of the standard userinfo claims. Here's an example of how to access it: jsonnet local claims = std.extVar('claims'); { identity: { traits: { // Access all raw claims raw_claims: claims.raw_claims, }, }, }
[External variable claims](https://www.ory.sh/docs/kratos/social-signin/data-mapping#external-variable-claims) 3. The claims
object typically has a structure similar to this: jsonnet { iss: "<https://accounts.google.com>", sub: "1234", name: "John Doe", given_name: "John", family_name: "Doe", email: "<mailto:john.doe@example.com|john.doe@example.com>", email_verified: true, // ... other standard claims ... raw_claims: { // Additional provider-specific claims }, }
[External variable claims](https://www.ory.sh/docs/kratos/social-signin/data-mapping#external-variable-claims) 4. You can access individual claims directly, for example: jsonnet local claims = std.extVar('claims'); { identity: { traits: { email: claims.email, name: claims.name, // ... other traits ... }, }, }
5. To debug and see all available claims, you could temporarily map all claims to your identity traits: jsonnet local claims = std.extVar('claims'); { identity: { traits: claims, }, }
This will allow you to see all available claims in the resulting identity. Remember, the available claims may vary depending on the social sign-in provider you're using. Some providers might require additional configuration or permissions to return certain claims. Also, keep in mind that you should be cautious when handling sensitive information and only map the claims you actually need for your application. Don't store unnecessary personal data in your identity traits. [Write a Jsonnet data mapper](https://www.ory.sh/docs/kratos/social-signin/data-mapping#write-a-jsonnet-data-mapper)