Skip to content

Commit 8c4caa2

Browse files
authored
fix the invalid scope by adding .default (#1678)
* fix the invalid scope by adding .default Signed-off-by: David Justice <[email protected]> * fix nightly warning causing build error Signed-off-by: David Justice <[email protected]> --------- Signed-off-by: David Justice <[email protected]>
1 parent ebb219b commit 8c4caa2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

sdk/data_cosmos/src/authorization_policy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ async fn generate_authorization(
190190
fn scope_from_url(url: &Url) -> String {
191191
let scheme = url.scheme();
192192
let hostname = url.host_str().unwrap();
193-
format!("{scheme}://{hostname}")
193+
format!("{scheme}://{hostname}/.default")
194194
}
195195

196196
/// This function generates a valid authorization string, according to the documentation.
@@ -368,6 +368,6 @@ mon, 01 jan 1900 01:00:00 gmt
368368
fn scope_from_url_01() {
369369
let scope =
370370
scope_from_url(&Url::parse("https://.documents.azure.com/dbs/test_db/colls").unwrap());
371-
assert_eq!(scope, "https://.documents.azure.com");
371+
assert_eq!(scope, "https://.documents.azure.com/.default");
372372
}
373373
}

sdk/iot_hub/examples/updatetwin.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
1818
println!("Updating device twin for device: {device_id}");
1919

2020
let service_client = ServiceClient::new_connection_string(iot_hub_connection_string, 3600)?;
21+
let json: String = serde_json::from_str(&payload).expect("Invalid JSON");
2122
let updated_twin = service_client
2223
.update_device_twin(device_id)
23-
.desired_properties(serde_json::from_str(&payload)?)
24+
.desired_properties(json)
2425
.await?;
2526

2627
println!("Received device twin: {updated_twin:?}");

0 commit comments

Comments
 (0)