我正在尝试学习如何检索Microsoft Store ID密钥。为此,我按照Microsoft在Windows Universal Samples中提供的示例进行了操作。我尝试使用Business to Business场景(场景7)。我已经发布了一个示例App并在Azure Active Directory中注册了该应用程序。问题是我不知道我应该在getCustomerCollectionsIdAsync / getCustomerPurchaseIdAsync函数中作为publisherUserId参数发送什么值。我尝试发送当前用户(客户电子邮件)的电子邮件,该电子邮件仅检索空结果(Microsoft Store ID密钥)。
function getCustomerCollectionsId() {
var token = getTokenFromAzureOAuthAsync().done(function (aadToken) {
if (aadToken) {
storeContext.getCustomerCollectionsIdAsync(aadToken, "***@hotmail.com")//"kim@example.com"
.done(function (result) {
output.innerText = result;
if (!result) {
WinJS.log && WinJS.log("getCustomerCollectionsIdAsync failed.", "sample", "error");
}
});
}
});
}
function getCustomerPurchaseId() {
var token = getTokenFromAzureOAuthAsync().done(function (aadToken) {
if (aadToken) {
storeContext.getCustomerPurchaseIdAsync(aadToken, "***@hotmail.com")//"kim@example.com"
.done(function (result) {
output.innerText = result;
if (!result) {
WinJS.log && WinJS.log("getCustomerPurchaseIdAsync failed.", "sample", "error");
}
});
}
});
}
答案 0 :(得分:0)
using Windows.Security.Authentication.Web;
...
string SID = WebAuthenticationBroker.GetCurrentApplicationCallbackUri().ToString();
如果您处于开发阶段,则可以尝试此操作。如果您担心将应用程序提交存储以进行Facebook身份验证之类的操作,这将很有帮助。下面给出的是我从中获得的参考。希望这会有所帮助!
答案 1 :(得分:0)
我遇到了同样的问题,这是适合我的解决方案。
转到https://portal.azure.com,选择“ Azure Active Directory”,选择“应用程序注册”,然后在右侧面板中选择您的应用程序。然后选择清单以编辑清单。将以下字段设置为值:
"accessTokenAcceptedVersion": 1,
"identifierUris": [
"https://onestore.microsoft.com",
"https://onestore.microsoft.com/b2b/keys/create/collections",
"https://onestore.microsoft.com/b2b/keys/create/purchase"
],
"signInAudience": "AzureADMyOrg",
并且您的获取令牌请求(https://login.microsoftonline.com/xxx/oauth2/token)的资源字段必须是确切的字符串“ https://onestore.microsoft.com/b2b/keys/create/collections”(注意,域部分是“ onestore.microsoft.com”)
ps: 找到此解决方案的方法:
我认为“ Azure Active Directory”是版本2的更新,但是“ Microsoft Store ID密钥”文档没有更新到该版本...