Reputation: 31
I'm trying to upload the file to Azure blob storage using SAS token by angular-azure-blob-service in typescript, I pass the following data to the upload method which is present in the service :
Object:
baseUrl: "https://xxxxxxxxx.blob.core.windows.net/containername/xx-image.png"
blockSize: 65536
complete: ƒ ()
error: ƒ (err)
file: File {name: "abc-image.png", lastModified: 1502710846384, lastModifiedDate: Mon Aug 14 2017 17:10:46 GMT+0530 (India Standard Time), webkitRelativePath: "", size: 17605, …}
progress: ƒ (percent)
sasToken: "?sv=2018-03-28&sr=b&sig=3whdfgdfzCeW0FSaZvmNfxh%2FdcUEcpjqmR%2BA%2FRlzHq8%3D&st=2019-04-16T12%3A46%3A47Z&se=2019-04-16T12%3A56%3A47Z&sp=w"
When i pass the above data, i get the below error :
error: "
AuthenticationFailed
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.↵RequestId:85189ba5-c01e-013f-614a-f4a448000000↵Time:2019-04-16T11:53:02.4545120ZSignature did not match. String to sign used was w↵2019-04-16T11:46:46Z↵2019-04-16T11:56:46Z↵/blob/xxxxxx/companylogo/background slider.PNG↵↵↵↵2018-03-28↵↵↵↵↵" headers: HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, lazyInit: ƒ} message: "Http failure response for https://xxxxxx.blob.core.windows.net/containername/background%20slider.PNG?sv=2018-03-28&sr=b&sig=JhdFAXD7P0QwyjAhClo9Axry%2FSSLp8POIQx4vJ0vxJ0%3D&st=2019-04-16T11%3A46%3A46Z&se=2019-04-16T11%3A56%3A46Z&sp=w&comp=block&blockid=YmxvY2stMDAwMDAw: 403 Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature." name: "HttpErrorResponse" ok: false status: 403 statusText: "Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature." url: "https://xxxxxxxxxxx.blob.core.windows.net/containername/background%20slider.PNG?sv=2018-03-28&sr=b&sig=JhdFAXD7P0QwyjAhClo9Axry%2FSSLp8POIQx4vJ0vxJ0%3D&st=2019-04-16T11%3A46%3A46Z&se=2019-04-16T11%3A56%3A46Z&sp=w&comp=block&blockid=YmxvY2stMDAwMDAw" proto: Object
Upvotes: 1
Views: 4563
Reputation: 22505
Will you take using Azure AD RBAC to uploading blobs to Azure storage into your account? This way will much easier than using SAS token if you just want to uploading files.With this feature , you can access your storage using access token which obtain from Azure AD instead of making up SAS token. For details , pls refer to : https://learn.microsoft.com/en-us/azure/storage/common/storage-auth-aad
Upvotes: 0