Do kratos properties map to hydra schemes somehow ...
# general
l
Do kratos properties map to hydra schemes somehow simply? Say I add
Copy code
"agreements": {
          "name": "Nõusolekud",
          "type": "object",
          "properties": {
            "store_newsletter": {
              "title": "store_newsletter",
              "type": "boolean"
            },
            "ahhaa_newsletter": {
              "title": "ahhaa_newsletter",
              "type": "boolean"
            }
          }
        },
into properties in the conf. And want them to be returned as part of userinfo using oauth2... (all selhfhosted)
h
not at this point, you will need to implement a custom consent endpoint where you can map this but we have no automated/no code way at the moment
l
Ok.. thankfully I have my own ui node in front of it.. So that would just go in here additionally?
Copy code
function extractSession(req, grantScope) {
    const session ={
        access_token: {},
        id_token: {},
    };
    const identity = req.session.identity;
    if(!identity) return session;

    if(grantScope.includes("email")) {
        const addresses = identity.verifiable_addresses || []
        if (addresses.length > 0) {
        const address = addresses[0]
        if (address.via === "email") {
            session.id_token.email = address.value
            session.id_token.email_verified = address.verified
        }
        }
    }
    if (grantScope.includes("profile")) {
        if (identity.traits.username) {
          session.id_token.preferred_username = identity.traits.username
        }
    
        if (identity.traits.website) {
          session.id_token.website = identity.traits.website
        }
    
        if (typeof identity.traits.name === "object") {
          if (identity.traits.name.first) {
            session.id_token.given_name = identity.traits.name.first
          }
          if (identity.traits.name.last) {
            session.id_token.family_name = identity.traits.name.last
          }
        } else if (typeof identity.traits.name === "string") {
          session.id_token.name = identity.traits.name
        }
    
        if (identity.updated_at) {
          session.id_token.updated_at = Date.parse(identity.updated_at)
        }
      }
      return session
}