-
Hey, I'm trying to add a separate field into the schema that will be filled with the user's avatar after he does oidc with github, but im not able to fill up that field. local claims = {
email_verified: false
} + std.extVar('claims');
{
identity: {
traits: {
[if "email" in claims && claims.email_verified then "email" else null]: claims.email,
[if "avatar_url" in claims then "avatar_url" else null]: claims.avatar_url,
},
},
} here is my schema {
"$id": "https://schemas.ory.sh/presets/kratos/quickstart/email-password/identity.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Person",
"type": "object",
"properties": {
"traits": {
"type": "object",
"properties": {
"email": {
"type": "string",
"format": "email",
"title": "E-Mail",
"minLength": 3,
"ory.sh/kratos": {
"credentials": {
"password": {
"identifier": true
}
},
"verification": {
"via": "email"
},
"recovery": {
"via": "email"
}
}
},
"avatar_url": {
"type": "string",
"description": "User's avatar pic",
"title": "Avatar"
}
},
"required": ["email"],
"additionalProperties": false
}
}
} But after i login /register in a clean env, it only adds email traits into the trait column of identities table. {
"email": "[email protected]"
} A help on this topic will be greatly appreciated |
Beta Was this translation helpful? Give feedback.
Answered by
spa5k
Aug 29, 2021
Replies: 1 comment
-
I was able to fix it by adding these extra things into kratos.yml providers:
- id: github
provider: github
client_id: # Add the client ID
client_secret: # Add the client secret
mapper_url: file:///etc/config/kratos/oidc.github.jsonnet
scope:
- user:email
requested_claims:
userinfo:
given_name:
essential: true
nickname: null
email:
essential: true
email_verified:
essential: true
picture:
essential: true then in oidc.github.jsonnet local claims = {
email_verified: false
} + std.extVar('claims');
{
identity: {
traits: {
[if "email" in claims && claims.email_verified then "email" else null]: claims.email,
[if "picture" in claims then "picture" else null]:claims.picture,
},
},
} and in schema like this instead of the old avatar_url field- "picture": {
"type": "string",
"description": "User's avatar pic",
"title": "Picture"
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
spa5k
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was able to fix it by adding these extra things into kratos.yml
then in oidc.github…