StoreDev / StoreLib

Storelib is a DotNet library that provides APIs to interact with the various Microsoft Store endpoints.
Mozilla Public License 2.0
139 stars 47 forks source link

Generating authentication tokens #18

Closed rtm516 closed 2 years ago

rtm516 commented 2 years ago

What's the best way of generating authentication tokens to query DCAT? I have tried using OpenXbox.XboxWebApi with no luck (I could just be passing the wrong token/format)

Currently, I use a token helper dll that uses windows to generate a new token but that only works on machines with windows 10+ and its not cross-platform. https://github.com/MCMrARM/mc-w10-version-launcher/tree/master/WUTokenHelper

My code using the token from that dll is below

await dcathandler.QueryDCATAsync("9NBLGGH2JHXJ", IdentiferType.ProductID, "Bearer WLID1.0=" + Convert.FromBase64String(token));
packages = await dcathandler.GetPackagesForProductAsync($"<User>{token}</User>");
TitleOS commented 2 years ago

With XboxWebApi, try generating a device or user token in the XBL 3.0 format, then pass that instead of a WLID1.0 token? I've always used XBL 3.0 tokens with DisplayCatalog.

rtm516 commented 2 years ago

Do you have an example snippet of this as I did attempt something but never got it working?