bland-finland-95044
08/26/2024, 5:17 PMchilly-king-10285
08/26/2024, 5:17 PMchilly-king-10285
08/26/2024, 5:17 PMbash curl -X PATCH --location "<https://api.console.ory.sh/projects/{{project_id}}>" \ -H "Authorization: Bearer ory_wak_..." \ -H "Content-Type: application/json" \ -d '[ { "op": "add", "path": "/services/identity/config/selfservice/methods/oidc/config/providers/-", "value": { "client_id": "...", "client_secret": "...", "id": "ory-GPx1yPH4", "issuer_url": "<https://example.org>", "label": "My OIDC provider", "mapper_url": "<base64://ZnVuY3Rpb24oY3R4KSBjdHg>=", "organization_id": "6bb1c7d1-3b3e-4995-9e09-35649dc45a2b", "provider": "generic", "scope": ["openid", "offline_access", "email"] } } ]' \ | jq ".project.services.identity.config.selfservice.methods.oidc.config.providers"
Please note that the client_id
and client_secret
are the credentials of the OIDC provider, and the organization_id
is the ID of the organization to which the connection belongs. For more information, you can refer to the [Ory documentation](https://www.ory.sh/docs/kratos/organizations#create-an-sso-connections).bland-finland-95044
08/26/2024, 5:21 PMchilly-king-10285
08/26/2024, 5:21 PMchilly-king-10285
08/26/2024, 5:21 PMbash curl -X PATCH --location "<https://api.console.ory.sh/projects/{{project_id}}>" \ -H "Authorization: Bearer ory_wak_..." \ -H "Content-Type: application/json" \ -d '[ { "op": "add", "path": "/services/identity/config/selfservice/methods/oidc/config/providers/-", "value": { "client_id": "...", "client_secret": "...", "id": "ory-GPx1yPH4", "issuer_url": "<https://example.org>", "label": "My OIDC provider", "mapper_url": "<base64://ZnVuY3Rpb24oY3R4KSBjdHg>=", "organization_id": "6bb1c7d1-3b3e-4995-9e09-35649dc45a2b", "provider": "generic", "scope": ["openid", "offline_access", "email"] } } ]' \ | jq ".project.services.identity.config.selfservice.methods.oidc.config.providers"
For more information, you can refer to the [Ory documentation](https://www.ory.sh/docs/kratos/organizations#create-an-sso-connections).bland-finland-95044
08/26/2024, 5:37 PMchilly-king-10285
08/26/2024, 5:37 PMchilly-king-10285
08/26/2024, 5:37 PMsubject
in the oidc
credentials) is not directly settable during this process. This information is typically obtained and managed during the SSO login flow. Here is an example of how to create an identity programmatically: bash curl --request POST -sL \ --header "Authorization: Bearer ory_pat_xRKLsFEOUFQFVBjd6o3FQDifaLYhabGd" \ --header "Content-Type: application/json" \ --data '{ "schema_id": "<preset://email>", "traits": { "email": "[[email protected]](<https://www.ory.sh/cdn-cgi/l/email-protection>)" } }' <https://playground.projects.oryapis.com/admin/identities>
The server response contains the created identity: json { "id": "e01b5f2f-6afc-4194-8578-4cebcf69a4d5", "schema_id": "<preset://email>", "schema_url": "<https://playground.projects.oryapis.com/schemas/cHJlc2V0Oi8vZW1haWw>", "state": "active", "state_changed_at": "2022-02-24T13:38:05.27510048Z", "traits": { "email": "[[email protected]](<https://www.ory.sh/cdn-cgi/l/email-protection>)" }, ... }
For more information, you can refer to the [Ory documentation](https://www.ory.sh/docs/kratos/manage-identities/create-users-identities).bland-finland-95044
08/26/2024, 5:39 PMchilly-king-10285
08/26/2024, 5:39 PMchilly-king-10285
08/26/2024, 5:39 PMsubject
into credentials.oidc.config.providers.subject
. Here is an example of how data mapping is used in Ory: json local claims = { email_verified: false, } + std.extVar('claims'); { identity: { traits: { // Allowing unverified email addresses enables account // enumeration attacks, especially if the value is used for // e.g. verification or as a password login identifier. // // Therefore we only return the email if it (a) exists and (b) is marked verified // by GitHub. [if 'email' in claims && claims.email_verified then 'email' else null]: claims.email, }, }, }
In this example, the email
claim is mapped to the traits.email
field in the identity schema. For more information, you can refer to the [Ory documentation](https://www.ory.sh/docs/kratos/social-signin/github#data-mapping).