<@U04UQ68083H> is it possible to dump the claim fe...
# ory-copilot
c
@chilly-king-10285 is it possible to dump the claim fetched from oidc provider in kratos
b
A message from kapa.ai
Yes, it is possible to access and use the claims fetched from an OIDC provider in Ory Kratos. This can be done through the use of Jsonnet code snippets for data mapping. Here's how you can achieve this: 1. When configuring a social sign-in provider in Kratos, you can create a Jsonnet code snippet that maps the claims received from the OIDC provider to the Ory Identity schema. 2. In this Jsonnet snippet, you can access all the claims provided by the OIDC provider using
std.extVar('claims')
. This allows you to "dump" or use any of the claims received. 3. You can then map these claims to identity traits, or even store them in the identity's metadata. Here's an example of how you might do this:
Copy code
jsonnet local claims = std.extVar('claims');  {   identity: {     traits: {       email: claims.email     },     metadata_public: {       // Store all claims in public metadata       oidc_claims: claims,     },   } }
In this example, we're storing all the claims in the
metadata_public
field of the identity. This effectively "dumps" all the claims received from the OIDC provider. It's important to note that you should be cautious about which claims you store and where, especially when dealing with sensitive information. The [Ory documentation on setting identity metadata](https://www.ory.sh/docs/kratos/social-signin/data-mapping#set-identity-metadata) provides more information on this topic. Remember that Jsonnet code snippets used for data mapping aren't stored in an encrypted format in Ory Network, so you should avoid storing sensitive information directly in these snippets [Source](https://www.ory.sh/docs/kratos/social-signin/ory#data-mapping).
c
I am talking in the other direction when hydra is linked to kratos and I am using hydra as OIDC provider