以下代码在最后一行引发异常:
// Create a BlobServiceClient object which will be used to create a container client
System.out.println(String.format("Connection String %s", connectStr));
blobServiceClient = new BlobServiceClientBuilder().connectionString(connectStr).buildClient();
// Get a user delegation key for the Blob service that's valid for seven days.
// You can use the key to generate any number of shared access signatures over the lifetime of the key.
keyStart = OffsetDateTime.now();
keyExpiry = OffsetDateTime.now().plusHours(7);
error -> userDelegationKey = blobServiceClient.getUserDelegationKey(keyStart, keyExpiry);
例外:
</Message><AuthenticationErrorDetail>Only authentication scheme Bearer is supported</AuthenticationErrorDetail></Error>"
Caused by: com.azure.storage.blob.models.BlobStorageException: Status code 403, "<?xml version="1.0" encoding="utf-8"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:d375b3bf-b01e-0044-1191-9c75a8000000
我试图将.NET教程改编为 Java,但到目前为止还没有成功。
似乎这个错误与 REST API 调用有关,有什么想法吗?