Preflight Checklist
Describe your problem
Problem
The AuthenticationData model currently only supports the following fields:
class AuthenticationData {
String? type;
String? session;
}
However, according to the Matrix Client-Server API specification, UIA authentication stages may require additional parameters depending on the stage.
For example, the m.login.recaptcha stage requires the response field containing the captcha token.
Spec reference:
https://spec.matrix.org/v1.17/client-server-api/#google-recaptcha
Example request from the spec:
{
"auth": {
"type": "m.login.recaptcha",
"session": "SESSION_ID",
"response": "CAPTCHA_TOKEN"
}
}
Because AuthenticationData does not allow extra fields, it is currently impossible to send the required response value using the SDK.
This results in Synapse returning:
M_CAPTCHA_NEEDED: Captcha response is required
Describe your ideal solution
Proposed Solution
Allow arbitrary authentication parameters to be passed through the AuthenticationData model.
Example implementation:
class AuthenticationData {
String? type;
String? session;
Map<String, Object?>? additionalFields;
AuthenticationData({
this.type,
this.session,
this.additionalFields,
});
Map<String, Object?> toJson() {
final data = <String, Object?>{};
if (type != null) data['type'] = type;
if (session != null) data['session'] = session;
if (additionalFields != null) data.addAll(additionalFields!);
return data;
}
}
Example Usage
auth: AuthenticationData(
type: AuthenticationTypes.recaptcha,
session: session,
additionalFields: {
"response": captchaToken,
},
)
Why This Is Needed
Matrix UIA (User-Interactive Authentication) supports many authentication stages, each requiring different fields such as:
response for m.login.recaptcha
threepid_creds for m.login.email.identity
identifier / password for m.login.password
Restricting the model to only type and session prevents the SDK from supporting the full UIA specification.
Environment
- matrix-dart-sdk version: (your version)
- homeserver: Synapse
Version
6.1.1
Security requirements
No response
Additional Context
Register using captcha
Preflight Checklist
Describe your problem
Problem
The
AuthenticationDatamodel currently only supports the following fields:However, according to the Matrix Client-Server API specification, UIA authentication stages may require additional parameters depending on the stage.
For example, the
m.login.recaptchastage requires theresponsefield containing the captcha token.Spec reference:
https://spec.matrix.org/v1.17/client-server-api/#google-recaptcha
Example request from the spec:
Because
AuthenticationDatadoes not allow extra fields, it is currently impossible to send the requiredresponsevalue using the SDK.This results in Synapse returning:
M_CAPTCHA_NEEDED: Captcha response is requiredDescribe your ideal solution
Proposed Solution
Allow arbitrary authentication parameters to be passed through the
AuthenticationDatamodel.Example implementation:
Example Usage
Why This Is Needed
Matrix UIA (User-Interactive Authentication) supports many authentication stages, each requiring different fields such as:
responseform.login.recaptchathreepid_credsform.login.email.identityidentifier/passwordform.login.passwordRestricting the model to only
typeandsessionprevents the SDK from supporting the full UIA specification.Environment
Version
6.1.1
Security requirements
No response
Additional Context
Register using captcha