Find Microsoft Account Token in a WPF application

0

I've got a WPF application I've published it in the store using Desktop Bridge. I've setup

  • some add-ons,
  • a customer group with people on it
  • a targeted offer for an add-on and the customer group (defined above)

When a user of this group install the application, (s)he is not granted to the add-on.

How can I fix this?

I've found this documentation but it should be executed in the UWP application and mine is WPF released through Desktop Bridge.

Further information:

When I try to retrieve a MSA token with this code:

    private async Task<string> GetMicrosoftAccountTokenAsync()
    {
        var msaProvider = await WebAuthenticationCoreManager.FindAccountProviderAsync(
            "https://login.microsoft.com", "consumers");

        var request = new WebTokenRequest(msaProvider, "devcenter_implicit.basic,wl.basic");            
        var result = await WebAuthenticationCoreManager.RequestTokenAsync(request);

        return (result.ResponseStatus == WebTokenRequestStatus.Success)
            ? result.ResponseData[0].Token
            : string.Empty;
        }
    }

I have this error when trying to execute this line: await WebAuthenticationCoreManager.RequestTokenAsync(request);

System.Exception: 'Resource Contexts may not be created on threads that do not have a CoreWindow. (Exception from HRESULT: 0x80073B27)'

How can I specify a CoreWindow on my WPF UserControl

wpf
desktop-bridge
asked on Stack Overflow Apr 11, 2018 by JiBéDoublevé • edited Apr 13, 2018 by JiBéDoublevé

1 Answer

0

As the Use targeted offers to maximize engagement and conversions topic tips,

Targeted offers can only be used with UWP apps that include add-ons.

But your app is a packaged WPF app, according to the UWP APIs available to a packaged desktop app (Desktop Bridge) document,

Most UWP APIs work well on packaged desktop apps. However, some feature areas are not yet fully tested or currently functioning as intended.

So you can have a try with the Targeted offers in your desktop bridged wpf app following the Use targeted offers to maximize engagement and conversions document to create the offer in your dashboard and implement the in-app offer experience then submit your app to the Store.

answered on Stack Overflow Apr 12, 2018 by Breeze Liu - MSFT

User contributions licensed under CC BY-SA 3.0