Skip to content

How to use SAS credential

JinmingHu edited this page Nov 29, 2019 · 2 revisions

Here is an example of authorizing your requests with SAS token.

std::string account_name = "YOUR_ACCOUNT_NAME";
std::string sas_token = "?sv=2018-11-09&ss=bfqt&srt=sco&sp=rwdlacup&se=2020-01-01T00:00:00Z&st=2000-01-01T00:00:00Z&spr=https&sig=A_LONG_STRING";
auto cred = std::make_shared<azure::storage_lite::shared_access_signature_credential>(sas_token);
auto account = std::make_shared<azure::storage_lite::storage_account>(account_name, cred);
auto client = std::make_shared<azure::storage_lite::blob_client>(account, 1);

Note that the sv version in sas_token is supposed to match with header_value_storage_version defined in constants.dat. Or the request may get 403 error.

Clone this wiki locally