I created a WPF app using the ArcGIS Maps SDK .NET WPF App (Esri) template.
I copied in the ArcGISLoginPrompt class from the WPF samples.
I created a new app in AGOL and updated the appId in the WPF app.
The app runs, I am presented with the AGOL login window, can log in, and the app presents the protected resource (basemap, as configured from the Visual Studio template).
I then added a Windows Application Packaging Project project and added the WPF app as a reference.
Running the app via the packaging project I get
Esri.ArcGISRuntime.Http.ArcGISWebException: 'Unable to generate token.'
from within
credential = await AuthenticationManager.Current.GenerateCredentialAsync(info.ServiceUri);
If I switch Startup project back to the WPF app, it works fine again.
Using Fiddler I can see that when running via the packaging project, the app is calling /sharing/generateToken without any credentials so that error makes sense. The question is why is it calling that and not presenting the browser window.
Repro repo https://github.com/viktor-safar-geodata/wpf-arcgis-packaged