Hello, Is it possible to fill identity traits from...
# talk-kratos
g
Hello, Is it possible to fill identity traits from a Social Sign-in if invite link based registration is used? The flow is following: • I create a schema with email, firstname, lastname • I configure mapping in Microsoft Social Sign-in to use claims to populate email, firstname and lastname • I create an identity for a user with Ory CLI providing only the email • I generate an invite link with Ory CLI and share it with the user • The user opens the link, links Microsoft account • However the firstname and lastname claims remain empty
m
Hello @gifted-teacher-2132 Can you share the identity schema and mapping and the steps you take with the CLI to generate the links please?
g
Sure, identity schema: https://storage.googleapis.com/bac-gcs-production/d7abb0802f6d170fbc13f33a3ecd6640afed2c[…]05d1ec999e9ff783157f75385ad41ebf4050164ecd8ffbf526da.json mapping: https://storage.googleapis.com/bac-gcs-production/563f1ffa3c614e9e560bab84e05bc8984c5e00[…]a4841ff426695c9f22a544985c57f0a28ace10152e66cb883.jsonnet Steps are automated in this script:
Copy code
echo "Creating account in project $PROJECT_SLUG for $ADMIN_EMAIL"
account_id=$( curl --request POST -sL \
  --header "Authorization: Bearer $PROJECT_PAT" \
  --header "Content-Type: application/json" \
  --data "{
  \"schema_id\": \"d7abb0802f6d170fbc13f33a3ecd6640afed2c41d62dad30e33a99b1a31a0b70214b1083620805d1ec999e9ff783157f75385ad41ebf4050164ecd8ffbf526da\",
  \"traits\": {
     \"email\": \"$ADMIN_EMAIL\"
    }
  }" https://$<http://PROJECT_SLUG.projects.oryapis.com/admin/identities|PROJECT_SLUG.projects.oryapis.com/admin/identities> | jq -r .id )

recovery_link=$( curl --request POST -sL \
  --header "Authorization: Bearer $PROJECT_PAT" \
  --header "Content-Type: application/json" \
  --data "{
  \"expires_in\": \"12h\",
  \"identity_id\": \"$account_id\"
  }" https://$<http://PROJECT_SLUG.projects.oryapis.com/admin/recovery/link|PROJECT_SLUG.projects.oryapis.com/admin/recovery/link> | jq -r .recovery_link )

echo "Account created (ID: $account_id), share this link with $ADMIN_EMAIL:"
echo $recovery_link
m
Does the trait mapping work when you sign up “normally”, through a registration flow? Apologies I dont have a microsoft account to test this, but if we cant figure it out I will create one to test it firsthand
g
It does work through a normal registration flow.