Repository navigation
Replies: 1 comment
|
Update: Resolved by switching from URL-encoded parameters to JSON Body We are using this MFA SMS plugin: netzbegruenung Keycloak 2FA SMS Authenticator, which natively supports JSON templates and payload customization via its configuration properties. I managed to capture the raw payload using a webhook and found that the issue is strictly related to how the text is handled during URL encoding (where it gets double-escaped into When configuring the SMS plugin to send the payload as a JSON Body, Keycloak and the plugin preserve the newlines perfectly. The generated JSON raw content looks like this: {
"to": [
{
"phone_number": "+420 720 123 456
}
],
"body": "Your verification code is: %1$s\n\n@edshop.edsystem.cz #%1$s",
"flow": [
{
"sms": {
"sender": "eD system"
}
}
]
} |
Uh oh!
There was an error while loading. Please reload this page.
Hello everyone,
I am trying to format an SMS authentication message (
smsAuthText) using the Realm Localization override feature in the Keycloak Admin Console.My goal is to format the message to comply with the official WICG Origin-bound one-time codes specification, which strictly requires the origin-bound line to be the last line of the message (separated by a newline).
Example target format:
However, the localization input field seems to aggressively sanitize or disallow newline characters. I have tried multiple workarounds, but none of them worked:
\nor\\n: Entered directly into the Admin UI. It either renders as literal text in the SMS or gets mangled (e.g., showing asnn).<br>, but it is treated as plain text.<textarea>in the browser to force a real carriage return. The UI saves it, but the newlines are stripped/ignored.PUTrequest to/admin/realms/{realm}/localization/{locale}/smsAuthTextwithtext/plainand actual line breaks in the raw body.Is there any supported way to inject a newline character into a specific realm localization key without having to completely rebuild/redeploy the theme's
.propertiesfiles? Or is the localization override feature strictly limited to single-line strings by design?Thank you for any insights or workarounds!
All reactions