Skip to content

Commit 573c7dd

Browse files
committed
feat(oidc_client): add extra_scopes option to request_device_authorization
1 parent 65dbe14 commit 573c7dd

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

crates/matrix-sdk/src/authentication/common_oidc/oidc_client.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ impl OidcClient {
124124
pub(crate) async fn request_device_authorization(
125125
&self,
126126
device_id: Curve25519PublicKey,
127+
extra_scopes: Option<Vec<String>>,
127128
) -> Result<CoreDeviceAuthorizationResponse, DeviceAuhorizationOidcError> {
128129
let scopes = [
129130
ScopeToken::Openid,
@@ -134,7 +135,9 @@ impl OidcClient {
134135
),
135136
]
136137
.into_iter()
137-
.map(|scope| Scope::new(scope.to_string()));
138+
.map(|scope| scope.to_string())
139+
.chain(extra_scopes.unwrap_or_default())
140+
.map(Scope::new);
138141

139142
let details: CoreDeviceAuthorizationResponse = self
140143
.inner

crates/matrix-sdk/src/authentication/qrcode/login.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ impl<'a> IntoFuture for LoginWithQrCode<'a> {
128128
// Let's tell the OIDC provider that we want to log in using the device
129129
// authorization grant described in [RFC8628](https://datatracker.ietf.org/doc/html/rfc8628).
130130
trace!("Requesting device authorization.");
131-
let auth_grant_response = oidc_client.request_device_authorization(device_id).await?;
131+
let auth_grant_response =
132+
oidc_client.request_device_authorization(device_id, None).await?;
132133

133134
// Now we need to inform the other device of the login protocols we picked and
134135
// the URL they should use to log us in.

0 commit comments

Comments
 (0)