Reputation: 141
I'm trying to learn how to retrieve the Microsoft Store ID key. For this, I followed the examples provided by Microsoft in Windows Universal Samples. I tried to use the Business to Business scenario (scenario 7). I already published a sample App and registered the app in Azure Active Directory. The problem is I don't know what value should I send as the publisherUserId parameter in the getCustomerCollectionsIdAsync/getCustomerPurchaseIdAsync functions. I tried to send the email of the current user (customer email) which only retrieves an empty result (Microsoft Store ID key).
function getCustomerCollectionsId() {
var token = getTokenFromAzureOAuthAsync().done(function (aadToken) {
if (aadToken) {
storeContext.getCustomerCollectionsIdAsync(aadToken, "***@hotmail.com")//"[email protected]"
.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")//"[email protected]"
.done(function (result) {
output.innerText = result;
if (!result) {
WinJS.log && WinJS.log("getCustomerPurchaseIdAsync failed.", "sample", "error");
}
});
}
});
}
Upvotes: 14
Views: 1974
Reputation: 1627
I have face the same problem, here is the solution works for me.
Go to https://portal.azure.com ,choose "Azure Active Directory" , choose "App registrations" , choose your application in the right panel. then Choose Manifest to edit it manifest. set following fields to the value:
"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",
And the resource field of your get token request (https://login.microsoftonline.com/xxx/oauth2/token) must be the exact string "https://onestore.microsoft.com/b2b/keys/create/collections" (notice that the domain part is "onestore.microsoft.com")
ps: My way to find out this solution:
I think that "Azure Active Directory" is update to version 2, but the document of "Microsoft Store ID key" is not update to that version ...
Upvotes: 1
Reputation: 151
using Windows.Security.Authentication.Web;
...
string SID = WebAuthenticationBroker.GetCurrentApplicationCallbackUri().ToString();
You can try this if you are in the development phase. This will be helpful if you are stuck worrying about submitting the app to store to do something like Facebook authentication. Given below is the reference I got it from. Hope this helped!
http://microsoft.github.io/winsdkfb/index.html
Upvotes: -1