Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. #411

Open
bleze opened this issue Feb 9, 2022 · 4 comments

Comments

@bleze
Copy link

bleze commented Feb 9, 2022

Hi
I have working code which works for normal auth and SAS, but not when SAS is for a container.
The same SAS Token works fine in Storage Explorer, but not through SDK (7.5.0), where I get the error in topic.

azure::storage::cloud_storage_account storage_account;
{
	auto storage_credentials = azure::storage::storage_credentials(leStorageAccountName->text().toStdWString(), 	azure::storage::storage_credentials::sas_credential(leSASToken->text().toStdWString()));
	if (storage_credentials.is_sas() == true)
		storage_account = azure::storage::cloud_storage_account(storage_credentials, true);
}
if (storage_account.is_initialized() == true)
{
	azure::storage::cloud_blob_client blob_client = storage_account.create_cloud_blob_client();
	blob_client.list_containers(); // <- exception occurs here
}

Any ideas what might be wrong? Hopefully in my code and not the SDK :)
Thanks

@Jinming-Hu
Copy link
Member

What is the error message in the exception?

Can you share an example of your SAS token, with the sensitive information redacted (the part after sig=)?

Also, since this SDK has been deprecated, we won't fix it even if this was a bug. I suggest you try our Track2 SDK.

@bleze
Copy link
Author

bleze commented Feb 10, 2022

Hi Jimming, thanks for the reply!

The exception message is verbose copied to topic of issue.

Here is example of token; https://sgldocumentsdev.blob.core.windows.net/?sv=2020-08-04&ss=bfqt&srt=sco&sp=rwdlacupitfx&se=2022-12-10T18:10:04Z&st=2021-12-10T10:10:04Z&spr=https&sig=

Since the token works fine in Storage Explorer, and I simply cannot see anything wrong with my code, I came here for help.

Working with Microsoft technology is job security. Constantly having to rewrite code due to deprecation. I really hope there is something wrong in my code so I can get this token working, because I'm pressed for time and really do not want to rewrite all this :)

@Jinming-Hu
Copy link
Member

Hi @bleze , can you double check in your code snippet, leSASToken->text().toStdWString() only returns SAS token excluding schema, domain and path. i.e.

?sv=2020-08-04&ss=bfqt&srt=sco&sp=rwdlacupitfx&se=2022-12-10T18:10:04Z&st=2021-12-10T10:10:04Z&spr=https&sig=XXX is the SAS token.

@bleze
Copy link
Author

bleze commented Feb 11, 2022

Hi Jimming, you're a life saver! I'm pretty sure other tokens with full url has worked with this code, but they weren't for a container. I will have to dig into this, but right now I'm happy. I will add code to split url using regex to make UI more user friendly. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants