swift-fountain-14586
12/04/2024, 9:34 PMbrief-egg-61061
12/04/2024, 9:34 PMbrief-egg-61061
12/04/2024, 9:35 PMory patch identity-config --project ${project_id} \
--add '/courier/channels=[{"id":"sms","request_config":{"method":"PUT","body":"<base64://ZnVuY3Rpb24oY3R4KSB7DQpjdHg6IGN0eCwNCn0>=","url":"<https://your-sms-provider-url.com>"}]'
Replace <https://your-sms-provider-url.com>
with the actual URL of your SMS provider.
2. Configure the SMS template:
You need to add the SMS template for the registration code. Add the following to your Ory configuration [using the Ory CLI](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates#creating-templates):
ory patch identity-config --project ${project_id} \
--add '/courier/templates/registration_code/valid/sms/body/plaintext="Your registration code is: {{ .RegistrationCode }}"'
3. Ensure your identity schema is correctly configured:
Make sure your identity schema includes a phone number trait that is marked for verification via SMS. Here's an example of how your schema should look [according to the documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation#phone-number-verification):
json
{
"properties": {
"traits": {
"type": "object",
"properties": {
"phone": {
"type": "string",
"title": "Phone number",
"format": "tel",
"<http://ory.sh/kratos|ory.sh/kratos>": {
"verification": {
"via": "sms"
}
}
}
}
}
}
}
4. Enable passwordless login with one-time code:
Make sure you have enabled the one-time code strategy for passwordless login [as described in the documentation](https://www.ory.sh/docs/kratos/passwordless/one-time-code#enable-sms-one-time-code-otp):
ory patch identity-config <your-project-id> \
--add '/selfservice/methods/code/passwordless_enabled=true'
After making these changes, your SMS templates should be properly configured, and you should no longer encounter the "Expected sms template but got <nil>" error.brief-egg-61061
12/04/2024, 9:35 PMory patch identity-config --project ${project_id} \ --add '/courier/channels=[{"id":"sms","request_config":{"method":"PUT","body":"<base64://ZnVuY3Rpb24oY3R4KSB7DQpjdHg6IGN0eCwNCn0>=","url":"<https://your-sms-provider-url.com>"}]'
Replace <https://your-sms-provider-url.com>
with the actual URL of your SMS provider. 2. Configure the SMS template: You need to add the SMS template for the registration code. Add the following to your Ory configuration [using the Ory CLI](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates#creating-templates): ory patch identity-config --project ${project_id} \ --add '/courier/templates/registration_code/valid/sms/body/plaintext="Your registration code is: {{ .RegistrationCode }}"'
3. Ensure your identity schema is correctly configured: Make sure your identity schema includes a phone number trait that is marked for verification via SMS. Here's an example of how your schema should look [according to the documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation#phone-number-verification): json { "properties": { "traits": { "type": "object", "properties": { "phone": { "type": "string", "title": "Phone number", "format": "tel", "<http://ory.sh/kratos|ory.sh/kratos>": { "verification": { "via": "sms" } } } } } } }
4. Enable passwordless login with one-time code: Make sure you have enabled the one-time code strategy for passwordless login [as described in the documentation](https://www.ory.sh/docs/kratos/passwordless/one-time-code#enable-sms-one-time-code-otp): ory patch identity-config <your-project-id> \ --add '/selfservice/methods/code/passwordless_enabled=true'
After making these changes, your SMS templates should be properly configured, and you should no longer encounter the "Expected sms template but got <nil>" error. Remember that SMS-based authentication is considered less secure than other methods, as mentioned in the [overview of login and authentication methods](https://www.ory.sh/overview-login-password-passkey-webauthn-totp-sso-faceid/#login-code-via-sms). Consider using more secure authentication methods if possible. If you continue to experience issues after making these changes, you may need to review your entire Ory configuration or consult the Ory community for further assistance.