none
[UWP]Can't get a Microsoft Store ID key with StoreContext.GetCustomerCollectionsIdAsync RRS feed

  • Question

  • I'm trying to get user licenses for UWP apps server side by following the guidelines on this page: https://docs.microsoft.com/en-us/windows/uwp/monetize/view-and-grant-products-from-a-service

    It states that the second parameter in the StoreContext.GetCustomerCollectionsIdAsync method, the publisherUserId is optional. However, whatever I fill in, I either get an exception or an empty string as a result.

    What am I doing wrong?


    Saturday, June 16, 2018 10:01 AM

All replies

  • Hi Monne Onrust,

    This string, if supplied, will be echoed back in the result.  It's a convenience tool to allow the caller to "tag" the jwt that is produced. As such, it's likely the case that the errors being experienced have a different cause than this field. Please submit this issue on Windows 10 Feedback Hub, so that we could have logs.

    Best Regards,

    Xavier Xie


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, June 19, 2018 2:13 AM
    Moderator
  • Hi Xavier,

    Thanks for responding. Good to know the publisherUserID should be echoed back. The Feedback Hub is currently not working. I get an 0x8007139f error. 

    This is the code I'm using to get an Azure AD token. It works fine, I get a Bearer token back.

    using (var client = new HttpClient())
    {
        client.BaseAddress = new Uri("https://login.microsoftonline.com/");
    
        var request = new HttpRequestMessage(HttpMethod.Post, "mytenantid/oauth2/token");
        request.Content = new StringContent("grant_type=client_credentials&client_id=<myclientid>&client_secret=<myclientsecret>&resource=https://onestore.microsoft.com/b2b/keys/create/collections", Encoding.UTF8, "application/x-www-form-urlencoded");
    
        var result = await client.SendAsync(request);
        var resultContent = await result.Content.ReadAsStringAsync();
    }

    This is what I'm doing in my app, using the token in the resultContent:

    var result = await StoreContext.GetDefault().GetCustomerCollectionsIdAsync("<Azure AD token>","a");
    

    I just get an empty string back.

    I'm working in a debug version of our app. That should work too, right? Or does it only work for a store published version? Our app has been in the store for a couple of years and this is just further development.



    Thursday, June 21, 2018 8:00 AM
  • Hi Monne Onrust,

    >I'm working in a debug version of our app. That should work too, right? Or does it only work for a store published version? 

    Yes. It should work. But please note that The Windows.Services.Store namespace does not provide a class that you can use to simulate license info during testing. If you use the Windows.Services.Store namespace to implement in-app purchases or trials, you must publish your app to the Store and download the app to your development device to use its license for testing.

    So, please check if you first installed it from windows store. Then, you debug in visual studio and cover it on your local machine. With these steps, when you test, it will use the store license to test.

    After that, if you still get the same issue. Then, we need your log to help identity this issue, could you please find another pc and submit your issue on hte FeedbackHub?

    Best Regards,

    Xavier



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, June 22, 2018 3:28 AM
    Moderator