Skip to content

Commit

Permalink
GenJWT falls back to the deprecated API
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosNihelton committed Oct 16, 2023
1 parent 9c7547a commit 227b6f0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions storeapi/base/impl/StoreContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "StoreContext.hpp"

#include <winrt/Windows.ApplicationModel.Store.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Security.Cryptography.core.h>
Expand Down Expand Up @@ -101,9 +102,14 @@ std::vector<StoreContext::Product> StoreContext::GetProducts(
std::string StoreContext::GenerateUserJwt(std::string token,
std::string userId) const {
assert(!token.empty() && "Azure AD token is required");
auto hJwt = self.GetCustomerPurchaseIdAsync(winrt::to_hstring(token),
winrt::to_hstring(userId))
.get();
auto hToken = winrt::to_hstring(token);
auto hUserId = winrt::to_hstring(userId);
auto hJwt = self.GetCustomerPurchaseIdAsync(hToken, hUserId).get();
if (hJwt.empty()) {
hJwt = winrt::Windows::ApplicationModel::Store::CurrentApp::
GetCustomerPurchaseIdAsync(hToken, hUserId)
.get();
}
return winrt::to_string(hJwt);
}

Expand Down

0 comments on commit 227b6f0

Please sign in to comment.