worried-journalist-71921
08/12/2024, 1:18 PMchilly-king-10285
08/12/2024, 1:18 PMchilly-king-10285
08/12/2024, 1:18 PMjson { "$id": "<http://mydomain.com/schemas/v2/customer.schema.json>", "$schema": "<http://json-schema.org/draft-07/schema#>", "title": "A customer (v2)", "type": "object", "properties": { "traits": { "type": "object", "properties": { "email": { "title": "E-Mail", "type": "string", "format": "email", "<http://ory.sh/kratos|ory.sh/kratos>": { "credentials": { "password": { "identifier": true } } } } }, "required": ["email"], "additionalProperties": false } } }
In this schema, the email
field is used as the identifier for the password flow. This means that Ory will understand that traits.email='[email protected]'
is the identifier for this identity. The system must get '[email protected]'
and a password to sign in a user. Please note that the format
field of the identity schema will perform validation of the given trait. In this example, the email address is validated using the [JSON Schema](https://json-schema.org/understanding-json-schema/reference/string.html#email-addresses) rule set. For more information, you can refer to the [Ory documentation](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#email).worried-journalist-71921
08/12/2024, 1:19 PMfunc (k *OryServiceImpl) GetIdentity(identityID string) (*openapiclient.Identity, error) {
ctx := context.Background()
identity, response, err := k.client.IdentityAPI.GetIdentity(ctx, identityID).Execute()
if err != nil {
return nil, fmt.Errorf("error calling ProjectAPI.CreateIdentity: %v\nFull HTTP response: %v", err, response)
}
return identity, nil
}
chilly-king-10285
08/12/2024, 1:19 PMchilly-king-10285
08/12/2024, 1:19 PMGetIdentity
method in the SDK requires an identity ID as a parameter. The typical flow would be to authenticate the user using their email and password, which would return a session containing the user's identity. However, this does not provide a direct way to retrieve an identity using only an email. If you need to retrieve identities by email, you might need to implement a custom solution in your application, such as maintaining a mapping of emails to identity IDs in your own database. Please refer to the [Ory Kratos Go SDK documentation](https://www.ory.sh/docs/kratos/sdk/go) for more information.worried-journalist-71921
08/12/2024, 1:26 PMchilly-king-10285
08/12/2024, 1:26 PMchilly-king-10285
08/12/2024, 1:26 PMListIdentities
method in the SDK does not accept any parameters for filtering. Here is the method signature for `ListIdentities`: go func (a *AdminApiService) ListIdentities(ctx context.Context) AdminApiApiListIdentitiesRequest
As you can see, it does not accept any parameters for filtering. If you need to list identities by email, you might need to implement a custom solution in your application, such as maintaining a mapping of emails to identity IDs in your own database, and then filtering based on this. Please refer to the [Ory Kratos Go SDK documentation](https://www.ory.sh/docs/kratos/sdk/go) for more information.