@@ -78,7 +78,7 @@ use ruma::{
78
78
RoomAccountDataEvent as RumaRoomAccountDataEvent ,
79
79
} ,
80
80
push:: { HttpPusherData as RumaHttpPusherData , PushFormat as RumaPushFormat } ,
81
- OwnedServerName , RoomAliasId , RoomOrAliasId , ServerName ,
81
+ OwnedDeviceId , OwnedServerName , RoomAliasId , RoomOrAliasId , ServerName ,
82
82
} ;
83
83
use serde:: { Deserialize , Serialize } ;
84
84
use serde_json:: { json, Value } ;
@@ -457,16 +457,25 @@ impl Client {
457
457
/// However, it should be noted that when providing a user ID as a hint
458
458
/// for MAS (with no upstream provider), then the format to use is defined
459
459
/// by [MSC4198]: https://github.com/matrix-org/matrix-spec-proposals/pull/4198
460
+ ///
461
+ /// * `device_id` - The unique ID that will be associated with the session.
462
+ /// If not set, a random one will be generated. It can be an existing
463
+ /// device ID from a previous login call. Note that this should be done
464
+ /// only if the client also holds the corresponding encryption keys.
460
465
pub async fn url_for_oidc (
461
466
& self ,
462
467
oidc_configuration : & OidcConfiguration ,
463
468
prompt : Option < OidcPrompt > ,
464
469
login_hint : Option < String > ,
470
+ device_id : Option < String > ,
465
471
) -> Result < Arc < OAuthAuthorizationData > , OidcError > {
466
472
let registration_data = oidc_configuration. registration_data ( ) ?;
467
473
let redirect_uri = oidc_configuration. redirect_uri ( ) ?;
468
474
469
- let mut url_builder = self . inner . oauth ( ) . login ( redirect_uri, None , Some ( registration_data) ) ;
475
+ let device_id = device_id. map ( |id| OwnedDeviceId :: from ( id) ) ;
476
+
477
+ let mut url_builder =
478
+ self . inner . oauth ( ) . login ( redirect_uri, device_id, Some ( registration_data) ) ;
470
479
471
480
if let Some ( prompt) = prompt {
472
481
url_builder = url_builder. prompt ( vec ! [ prompt. into( ) ] ) ;
0 commit comments