question

Manny-3319 avatar image
0 Votes"
Manny-3319 asked ·

GetCustomerCollectionsIdAsync returns NULL without error

Neither the documentation nor the sample code hints that NULL is a possible return from this operation, but that's what we're getting. The async status is "completed", the (incorrectly documented) ErrorCode HRESULT is 0, GetResults returns NULL without an exception. What might be causing that? Thanks, --Manny

windows-uwp
· 5
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

This method has two parameters (String serviceTicket, String publisherUserId), please check if they are correct.

0 Votes 0 ·

serviceTicket is an access token from "login.microsoftonline.com/(our tenet id)/oauth2/token" for the resource url "https://onestore.microsoft.com/b2b/keys/create/collections", from our azure application linked to our partner center application. For publisherUserId we're passing an integer converted to a string, in this case it's just "12". The application has been in the store for about 2 years using the old Windows::ApplicationModel::Store, we're converting it to use Windows::Services::Store so we can add subscriptions. I'm able to get the purchase I made using a promo code, but I can't verify it on the server without a customer collections id.

0 Votes 0 ·

Curiously, substituting "fake" for the access token also results in null without errors. Error handling could certainly be improved here. I did notice, however, a cryptic line in the debug output of Visual Studio. I re-ran with a proper access token and the same line appears. It's "ERROR:ChkHr(storeContextServer->GetCustomerCollectionsId( _serviceTicket.Get(), _publisherUserId.Get(), cv.GetHStringReference().Get(), _collectionsId.GetAddressOf())) (0x80190191) [Windows::Services::Store::GetCustomerCollectionsIdOperation::DoWork]"

0 Votes 0 ·

The code, 0x80190191, appears, possibly coincidentally, on this page (https://docs.microsoft.com/en-us/windows/win32/bits/bits-return-values) and suggests it's code for an HTTP 401 authentication error. Why that's not raised by GetCustomerCollectionsIdAsync is one issue, but how can I have an authentication error with a valid access token?

0 Votes 0 ·

Out of curiosity, I called the old Windows::ApplicationModel::Store::CurrentApp::GetCustomerPurchaseIdAsync, and it does throw a 401 exception instead of silently returning NULL, so the bug is in the new API only. Still no clues about what might be causing the error.

0 Votes 0 ·

1 Answer

Manny-3319 avatar image
0 Votes"
Manny-3319 answered ·

The documentation states "Pass the Azure AD access token that has the audience URI value https://onestore.microsoft.com/b2b/keys/create/collections". This is INCORRECT. The actual URI that works is "https://onestore.microsoft.com".

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.