diff --git a/storeapi/base/impl/StoreContext.cpp b/storeapi/base/impl/StoreContext.cpp index 0d155b4f4..54ed91f61 100644 --- a/storeapi/base/impl/StoreContext.cpp +++ b/storeapi/base/impl/StoreContext.cpp @@ -2,6 +2,7 @@ #include "StoreContext.hpp" +#include #include #include #include @@ -101,9 +102,14 @@ std::vector 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); }