Skip to content

Commit be6d5f9

Browse files
pixlwavepoljar
authored andcommitted
ffi: Add support for the login hints with OIDC.
1 parent 506060f commit be6d5f9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

bindings/matrix-sdk-ffi/src/client.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,18 @@ impl Client {
400400
/// * `prompt` - The desired user experience in the web UI. No value means
401401
/// that the user wishes to login into an existing account, and a value of
402402
/// `Create` means that the user wishes to register a new account.
403+
///
404+
/// * `login_hint` - A generic login hint that an identity provider can use
405+
/// to pre-fill the login form. The format of this hint is not restricted
406+
/// by the spec as external providers all have their own way to handle the hint.
407+
/// However, it should be noted that when providing a user ID as a hint
408+
/// for MAS (with no upstream provider), then the format to use is defined
409+
/// by [MSC4198]: https://github.com/matrix-org/matrix-spec-proposals/pull/4198
403410
pub async fn url_for_oidc(
404411
&self,
405412
oidc_configuration: &OidcConfiguration,
406413
prompt: Option<OidcPrompt>,
414+
login_hint: Option<String>,
407415
) -> Result<Arc<OAuthAuthorizationData>, OidcError> {
408416
let registration_data = oidc_configuration.registration_data()?;
409417
let redirect_uri = oidc_configuration.redirect_uri()?;
@@ -413,6 +421,9 @@ impl Client {
413421
if let Some(prompt) = prompt {
414422
url_builder = url_builder.prompt(vec![prompt.into()]);
415423
}
424+
if let Some(login_hint) = login_hint {
425+
url_builder = url_builder.login_hint(login_hint);
426+
}
416427

417428
let data = url_builder.build().await?;
418429

0 commit comments

Comments
 (0)